From 4468522a4dbb4178e6a1101dfc73a74fdeae47d2 Mon Sep 17 00:00:00 2001 From: zertyuiop Date: Mon, 2 Dec 2024 13:24:21 +0300 Subject: [PATCH] Fix broken target language detection Commit #745 Query 745 broke the detection of the target language, removed unnecessary conditions and fixed the order of lines --- manga_translator/manga_translator.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/manga_translator/manga_translator.py b/manga_translator/manga_translator.py index 324a87fc7..c9d02144b 100644 --- a/manga_translator/manga_translator.py +++ b/manga_translator/manga_translator.py @@ -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)) @@ -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) \ No newline at end of file + self.add_progress_hook(ph)