diff --git a/src/LunaTranslator/LunaTranslator.py b/src/LunaTranslator/LunaTranslator.py index 0fdb32e0..9e9d3a4c 100644 --- a/src/LunaTranslator/LunaTranslator.py +++ b/src/LunaTranslator/LunaTranslator.py @@ -10,6 +10,7 @@ from myutils.config import ( static_data, getlanguse, set_font_default, + _TR, ) from ctypes import c_int, CFUNCTYPE, c_void_p from myutils.utils import ( @@ -512,11 +513,11 @@ class MAINUI: safe_callback = ( waitforresultcallback if waitforresultcallback else lambda _: 1 ) - + apiname = _TR(dynamicapiname(classname)) if iserror: if currentsignature == self.currentsignature: self.translation_ui.displaystatus.emit( - dynamicapiname(classname) + " " + res, + apiname + " " + res, True, False, ) @@ -540,7 +541,7 @@ class MAINUI: iter_res_status in (0, 1) ): displayreskwargs = dict( - name=dynamicapiname(classname), + name=apiname, color=globalconfig["fanyi"][classname]["color"], res=res, iter_context=(iter_res_status, classname), @@ -548,7 +549,7 @@ class MAINUI: self.translation_ui.displayres.emit(displayreskwargs) if iter_res_status in (0, 2): # 0为普通,1为iter,2为iter终止 - self.transhis.getnewtranssignal.emit(dynamicapiname(classname), res) + self.transhis.getnewtranssignal.emit(apiname, res) if not waitforresultcallback: if ( globalconfig["read_trans"] @@ -820,9 +821,7 @@ class MAINUI: return aclass(classname) except Exception as e: self.displayinfomessage( - dynamicapiname(classname) - + " import failed : " - + str(stringfyerror(e)), + dynamicapiname(classname) + " import failed : " + str(stringfyerror(e)), "", ) raise e diff --git a/src/LunaTranslator/translator/basetranslator.py b/src/LunaTranslator/translator/basetranslator.py index 69202002..c5ded588 100644 --- a/src/LunaTranslator/translator/basetranslator.py +++ b/src/LunaTranslator/translator/basetranslator.py @@ -363,12 +363,12 @@ class basetrans(commonbase): self.longtermcacheset(cache_use, res) def __parse_gpt_dict(self, contentsolved, optimization_params): - gpt_dict = None + gpt_dict = [] contentraw = contentsolved for _ in optimization_params: if isinstance(_, dict): _gpt_dict = _.get("gpt_dict", None) - if _gpt_dict is None: + if not _gpt_dict: continue gpt_dict = _gpt_dict contentraw = _.get("gpt_dict_origin")