1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-27 01:57:33 +00:00

Merge pull request #1268 from zx900930/development

improve chinese language codes matching rules
This commit is contained in:
morpheus65535 2021-02-14 21:04:11 -05:00 committed by GitHub
commit b4861e8102
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View file

@ -545,10 +545,8 @@ def guess_external_subtitles(dest_folder, subtitles):
detected_language = guess_language(text) detected_language = guess_language(text)
#add simplified and traditional chinese detection #add simplified and traditional chinese detection
if detected_language == 'zh': if detected_language == 'zh':
simplified_chinese = [".chs", ".sc", ".zhs", ".hans", ".gb", u"", u"双语"] traditional_chinese = [".cht", ".tc", ".traditional",".zh-tw", ".zht", "hant", "big5", u"", u"雙語"]
if any(ext in str(subtitle_path).lower() for ext in simplified_chinese): if any(ext in (str(subtitle_path).lower())[:-16] for ext in traditional_chinese):
detected_language == 'zh'
else:
detected_language == 'zt' detected_language == 'zt'
except UnicodeDecodeError: except UnicodeDecodeError:
detector = Detector() detector = Detector()

View file

@ -637,8 +637,8 @@ def _search_external_subtitles(path, languages=None, only_one=False, scandir_gen
hi = any(i for i in hi_tag if i in adv_tag) hi = any(i for i in hi_tag if i in adv_tag)
#add simplified/traditional chinese detection #add simplified/traditional chinese detection
simplified_chinese = ["chs", "sc", "zhs", "hans", "gb", u"", u"双语"] simplified_chinese = ["chs", "sc", "zhs", "hans","zh-hans", "gb", "", "简中", "简体", "简体中文", "中英双语", "中日双语","中法双语"]
traditional_chinese = ["cht", "tc", "zht", "hant", "big5", u"", u"雙語"] traditional_chinese = ["cht", "tc", "zht", "hant","zh-hant", "big5", "", "繁中", "繁体", "繁體","繁体中文", "繁體中文", "正體中文", "中英雙語", "中日雙語","中法雙語"]
FULL_LANGUAGE_LIST.extend(simplified_chinese) FULL_LANGUAGE_LIST.extend(simplified_chinese)
FULL_LANGUAGE_LIST.extend(traditional_chinese) FULL_LANGUAGE_LIST.extend(traditional_chinese)
p_root = p_root.replace('zh-TW', 'zht') p_root = p_root.replace('zh-TW', 'zht')