From b8dd0852c0546f27575da3b0b70c3a621516857c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B1=BC=E9=A6=99ROS?= <87068644+fishros@users.noreply.github.com> Date: Wed, 11 Sep 2024 16:35:53 +0800 Subject: [PATCH] fix(translator): format string --- tools/translation/translator.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/translation/translator.py b/tools/translation/translator.py index 0fd1500..096b59b 100644 --- a/tools/translation/translator.py +++ b/tools/translation/translator.py @@ -31,7 +31,7 @@ def __init__(self): # Load the translation file. self.lang = self._currentLocale for lang in _suported_languages: - CmdTask("wget {} -O /tmp/fishinstall/{} --no-check-certificate".format(lang_url.format(lang),lang_url.format(lang).replace(url_prefix,''))).run() + CmdTask("wget {} -O /tmp/fishinstall/{} --no-check-certificate".format(lang_url.format(lang), lang_url.format(lang).replace(url_prefix, ''))).run() self.loadTranslationFlile() tools.base.tr = self @@ -40,11 +40,11 @@ def loadTranslationFlile(self): # Load the translation file. import importlib try: - _import_command = f"tools.translation.assets.{self._currentLocale}" + _import_command = "tools.translation.assets.{}".format(self._currentLocale) self._translations = importlib.import_module(_import_command).translations except Exception: # If the translation file does not exist, use the default translation file. - _import_command = f"tools.translation.assets.en_US" + _import_command = "tools.translation.assets.en_US" self._translations = importlib.import_module(_import_command).translations def tr(self, string) -> str: @@ -56,7 +56,7 @@ def tr(self, string) -> str: return string def isCN(self) -> bool: - return self.country=='CN' + return self.country == 'CN' def getLocalFromIP(self) -> str: local_str = "" @@ -80,4 +80,3 @@ def getLocalFromIP(self) -> str: if __name__ == "__main__": # Test funcs tr = Linguist() - \ No newline at end of file