feat(file-check): 更新文件检核工具 API Key 配置及相关文档

This commit is contained in:
hugo committed 2026-06-17 22:29:15 +08:00
1 parent 634dee4b81
commit 55cf7ff734
74 files changed
+1525 -1182

No files matched your search

@@ -178,6 +178,7 @@ _MESSAGES: dict[str, dict[str, str]] = {
def normalize_lang(raw: Any) -> str:
"""将 lang/locale 别名规范化为 zh / en / th。"""
text = str(raw or "").strip().lower()
if not text:
return "zh"
@@ -194,6 +195,7 @@ def normalize_lang(raw: Any) -> str:
def resolve_lang(payload: dict[str, Any] | None = None) -> str:
"""从 payload 或 HTTP 请求头(X-Lang / Accept-Language)解析语言,默认 zh。"""
if isinstance(payload, dict):
for key in ("lang", "locale", "language"):
if key in payload:
@@ -212,5 +214,6 @@ def resolve_lang(payload: dict[str, Any] | None = None) -> str:
def t(key: str, *, lang: str | None = None) -> str:
"""按语言键查找 i18n 文案;未命中时回退 zh 或原 key。"""
resolved = normalize_lang(lang) if lang else "zh"
return _MESSAGES.get(resolved, {}).get(key) or _MESSAGES["zh"].get(key) or key