From a3ee1e482d9269a06e5d20c2b210bff4a1f8723a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Wed, 27 Mar 2024 16:48:57 +0800 Subject: [PATCH] bugfix --- LunaTranslator/LunaTranslator/LunaTranslator.py | 9 ++++----- LunaTranslator/files/defaultconfig/static_data.json | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/LunaTranslator/LunaTranslator/LunaTranslator.py b/LunaTranslator/LunaTranslator/LunaTranslator.py index 7a1fe665..f9e5083b 100644 --- a/LunaTranslator/LunaTranslator/LunaTranslator.py +++ b/LunaTranslator/LunaTranslator/LunaTranslator.py @@ -253,13 +253,14 @@ class MAINUI() : self.usefultranslators.remove(classname) if embedcallback is None and currentsignature!=self.currentsignature:return + returnandembedcallback = lambda x: embedcallback(x) if embedcallback else '' + if type(res)==str: if res.startswith(''): if currentsignature==self.currentsignature: self.translation_ui.displaystatus.emit(globalconfig['fanyi'][classname]['name']+' '+res[len(''):],'red',onlytrans,False) if len(self.usefultranslators)==0: - embedcallback('') - return + return returnandembedcallback('') res=self.solveaftertrans(res,optimization_params) @@ -286,9 +287,7 @@ class MAINUI() : pass if globalconfig['embedded']['as_fast_as_posible'] or classname==list(globalconfig['fanyi'])[globalconfig['embedded']['translator']]: - - embedcallback(kanjitrans(zhconv.convert(res,'zh-tw')) if globalconfig['embedded']['trans_kanji'] else res) - return + return returnandembedcallback(kanjitrans(zhconv.convert(res,'zh-tw')) if globalconfig['embedded']['trans_kanji'] else res) @threader diff --git a/LunaTranslator/files/defaultconfig/static_data.json b/LunaTranslator/files/defaultconfig/static_data.json index 364c9e2b..b58bfaf6 100644 --- a/LunaTranslator/files/defaultconfig/static_data.json +++ b/LunaTranslator/files/defaultconfig/static_data.json @@ -1,5 +1,5 @@ { - "version":"v2.40.2", + "version":"v2.40.3", "language_list_show":["简体中文","日本語","English","Русский язык","Español","한국어","Français","繁體中文","Tiếng Việt","Türkçe","Polski","Українська Мова","Italiano","اللغة العربية","ภาษาไทย","བོད་སྐད།"] , "language_list_translator":["简体中文","日文","英文","俄语","西班牙语","韩语","法语","繁体中文","越南语","土耳其语","波兰语","乌克兰语","意大利语","阿拉伯语","泰语","藏语"], "language_list_translator_inner":["zh", "ja", "en","ru","es","ko","fr","cht","vi","tr","pl","uk","it","ar","th","bo"],