Skip to content

Commit

Permalink
Merge pull request #767 from zertyuiop/main
Browse files Browse the repository at this point in the history
Fix broken target language detection
  • Loading branch information
zyddnys authored Dec 8, 2024
2 parents 0dede5d + 4468522 commit 6faf4b3
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions manga_translator/manga_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,27 +424,21 @@ async def _run_text_translation(self, config: Config, ctx: Context):
has_target_lang_in_translation = bool(re.search('[\u4e00-\u9fff]', region.translation))
elif config.translator.target_lang == 'JPN': # Japanese
has_target_lang = bool(re.search('[\u3040-\u309f\u30a0-\u30ff\u4e00-\u9fff]', region.text))
elif config.translator.target_lang == 'KOR': # Korean
has_target_lang_in_translation = bool(re.search('[\u3040-\u309f\u30a0-\u30ff\u4e00-\u9fff]', region.translation))
elif config.translator.target_lang == 'KOR': # Korean
has_target_lang = bool(re.search('[\uac00-\ud7af\u1100-\u11ff]', region.text))
elif config.translator.target_lang == 'ARA': # Arabic
has_target_lang_in_translation = bool(re.search('[\uac00-\ud7af\u1100-\u11ff]', region.translation))
elif config.translator.target_lang == 'ARA': # Arabic
has_target_lang = bool(re.search('[\u0600-\u06ff]', region.text))
elif config.translator.target_lang == 'THA': # Thai
has_target_lang_in_translation = bool(re.search('[\u0600-\u06ff]', region.translation))
elif config.translator.target_lang == 'THA': # Thai
has_target_lang = bool(re.search('[\u0e00-\u0e7f]', region.text))
elif config.translator.target_lang == 'RUS': # Russian
has_target_lang_in_translation = bool(re.search('[\u0e00-\u0e7f]', region.translation))
elif config.translator.target_lang == 'RUS': # Russian
has_target_lang = bool(re.search('[\u0400-\u04ff]', region.text))
elif config.translator.target_lang == 'UKR': # Ukrainian
has_target_lang_in_translation = bool(re.search('[\u0400-\u04ff]', region.translation))
elif config.translator.target_lang == 'UKR': # Ukrainian
has_target_lang = bool(re.search('[\u0400-\u04ff]', region.text))
elif config.translator.target_lang == 'IND': # Indonesian
has_target_lang_in_translation = bool(re.search('[\u0400-\u04ff]', region.translation))
elif config.translator.target_lang == 'IND': # Indonesian
has_target_lang = bool(re.search('[A-Za-z]', region.text))
Expand Down Expand Up @@ -594,4 +588,4 @@ async def ph(state, finished):
elif state in LOG_MESSAGES_ERROR:
logger.error(LOG_MESSAGES_ERROR[state])

self.add_progress_hook(ph)
self.add_progress_hook(ph)

0 comments on commit 6faf4b3

Please sign in to comment.