diff options
author | morpheus65535 <[email protected]> | 2024-10-01 00:01:28 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2024-10-01 00:01:28 -0400 |
commit | 7000d2ac2c7a52fd0c429c17f5e826e9e3633bfc (patch) | |
tree | 550a124d3c9efbd757313b7dd9a55f01a6e7f58a | |
parent | 79118a494c0a3c6bfe86a49a610fcad44e0aff50 (diff) | |
download | bazarr-7000d2ac2c7a52fd0c429c17f5e826e9e3633bfc.tar.gz bazarr-7000d2ac2c7a52fd0c429c17f5e826e9e3633bfc.zip |
Fixed subtitles translation to Portuguese. #2689v1.4.5-beta.8v1.4.5
-rw-r--r-- | bazarr/subtitles/tools/translate.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bazarr/subtitles/tools/translate.py b/bazarr/subtitles/tools/translate.py index 2b80bf951..935d3ebd1 100644 --- a/bazarr/subtitles/tools/translate.py +++ b/bazarr/subtitles/tools/translate.py @@ -28,9 +28,15 @@ def translate_subtitles_file(video_path, source_srt_file, from_lang, to_lang, fo } to_lang = alpha3_from_alpha2(to_lang) - lang_obj = CustomLanguage.from_value(to_lang, "alpha3") - if not lang_obj: + try: lang_obj = Language(to_lang) + except ValueError: + custom_lang_obj = CustomLanguage.from_value(to_lang, "alpha3") + if custom_lang_obj: + lang_obj = CustomLanguage.subzero_language(custom_lang_obj) + else: + logging.debug(f'BAZARR is unable to translate to {to_lang} for this subtitles: {source_srt_file}') + return False if forced: lang_obj = Language.rebuild(lang_obj, forced=True) if hi: |