Skip to content

Commit

Permalink
fix(translator): format string
Browse files Browse the repository at this point in the history
  • Loading branch information
fishros committed Sep 11, 2024
1 parent 89b5bf9 commit b8dd085
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tools/translation/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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 = ""
Expand All @@ -80,4 +80,3 @@ def getLocalFromIP(self) -> str:
if __name__ == "__main__":
# Test funcs
tr = Linguist()

0 comments on commit b8dd085

Please sign in to comment.