Fix/au 2128 (#35124)

* fix: update condition to always return a value

* feat: add comments on logic
This commit is contained in:
Rodrigo Martin
2024-07-16 20:29:49 -03:00
committed by GitHub
parent 8b1e6476cc
commit 60719bdfcc

View File

@@ -866,11 +866,12 @@ class VideoTranscriptsMixin:
"""
sub, other_lang = transcripts["sub"], transcripts["transcripts"]
if dest_lang:
if dest_lang in other_lang.keys():
transcript_language = dest_lang
elif dest_lang == 'en' and (not other_lang or (other_lang and sub)):
transcript_language = 'en'
# language in plugin selector exists as transcript
if dest_lang and dest_lang in other_lang.keys():
transcript_language = dest_lang
# language in plugin selector is english and empty transcripts or transcripts and sub exists
elif dest_lang and dest_lang == 'en' and (not other_lang or (other_lang and sub)):
transcript_language = 'en'
elif self.transcript_language in other_lang:
transcript_language = self.transcript_language
elif sub: