Skip to content

Commit

Permalink
fix(machinery): do not use DeepL for Chinese Traditional
Browse files Browse the repository at this point in the history
It doesn't support it and returns Chinese Simplified instead.

See #9451
  • Loading branch information
nijel committed Jun 19, 2024
1 parent efe944b commit c721aa5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion weblate/machinery/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ def uncleanup_results(

def get_language_possibilities(self, language: Language) -> Iterator[str]:
code = language.code
yield self.map_language_code(code)
mapped_code = self.map_language_code(code)
if not mapped_code:
return
yield mapped_code
code = code.replace("-", "_")
while "_" in code:
code = code.rsplit("_", 1)[0]
Expand Down
1 change: 1 addition & 0 deletions weblate/machinery/deepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class DeepLTranslation(
max_score = 91
language_map = {
"zh_Hans": "zh",
"zh_Hant": "", # Traditional Chinese not supported but would map to zh
"pt": "pt-pt",
}
force_uncleanup = True
Expand Down

0 comments on commit c721aa5

Please sign in to comment.