mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
feat(i18n): add global language resolution and localize user-facing text
This commit is contained in:
16
cli/utils.py
16
cli/utils.py
@@ -40,6 +40,22 @@ def load_config_json() -> dict:
|
||||
return {}
|
||||
|
||||
|
||||
def get_cli_language() -> str:
|
||||
"""Resolve the CLI UI language using the shared i18n detector.
|
||||
|
||||
Reads the `cow_lang` field from config.json (defaults to "auto") and runs
|
||||
the same detection used by the running app, so CLI output matches.
|
||||
"""
|
||||
ensure_sys_path()
|
||||
try:
|
||||
from common import i18n
|
||||
|
||||
configured = load_config_json().get("cow_lang", "auto")
|
||||
return i18n.resolve_language(configured)
|
||||
except Exception:
|
||||
return "en"
|
||||
|
||||
|
||||
def load_skills_config() -> dict:
|
||||
"""Load skills_config.json from the custom skills directory."""
|
||||
path = os.path.join(get_skills_dir(), "skills_config.json")
|
||||
|
||||
Reference in New Issue
Block a user