style: 代码格式化和字符串处理优化

- 优化代码缩进和换行,提高可读性
- 统一使用单引号或双引号,保持一致性
- 移除冗余的空格和括号,精简代码
This commit is contained in:
2025-02-15 21:30:24 +08:00
parent 94198f5a51
commit 1570ba320c
34 changed files with 948 additions and 358 deletions

View File

@@ -18,7 +18,7 @@ class TranslationManager:
def __init__(self, domain="xhs", localedir=None):
self.domain = domain
if not localedir:
localedir = ROOT.joinpath('locale')
localedir = ROOT.joinpath("locale")
self.localedir = Path(localedir)
self.current_translator = self.setup_translation(
self.get_language_code(),
@@ -41,7 +41,8 @@ class TranslationManager:
)
except FileNotFoundError as e:
print(
f"Warning: Translation files for '{self.domain}' not found. Error: {e}")
f"Warning: Translation files for '{self.domain}' not found. Error: {e}"
)
return translation(self.domain, fallback=True)
def switch_language(self, language: str = "en_US"):