mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
feat(installer): revamp install flow with i18n
This commit is contained in:
@@ -118,9 +118,11 @@ def run_install_browser(
|
||||
0 on success, 1 on fatal failure (pip or chromium install failed).
|
||||
"""
|
||||
from cli.utils import get_cli_language
|
||||
from common import i18n
|
||||
|
||||
# Import `common` only after get_cli_language() runs ensure_sys_path(),
|
||||
# so it works when `cow` is invoked from outside the project directory.
|
||||
get_cli_language() # resolve cow_lang so i18n.t reflects config
|
||||
from common import i18n
|
||||
_t = i18n.t
|
||||
|
||||
stream = stream or _default_stream
|
||||
|
||||
@@ -276,9 +276,12 @@ def status():
|
||||
"""Show CowAgent running status."""
|
||||
from cli import __version__
|
||||
from cli.utils import load_config_json, get_cli_language
|
||||
from common import i18n
|
||||
|
||||
# get_cli_language() calls ensure_sys_path(), which adds the project root
|
||||
# to sys.path. Import `common` only AFTER that, otherwise it fails with
|
||||
# ModuleNotFoundError when `cow` runs from outside the project dir.
|
||||
get_cli_language() # resolve cow_lang so i18n.t reflects config
|
||||
from common import i18n
|
||||
_t = i18n.t
|
||||
|
||||
pid = _read_pid()
|
||||
|
||||
@@ -518,9 +518,11 @@ def _install_targz_bytes(content: bytes, name: str, skills_dir: str, result: Ins
|
||||
def _print_install_success(name: str, source: str):
|
||||
"""Print a unified install success message with description and source."""
|
||||
from cli.utils import get_cli_language
|
||||
from common import i18n
|
||||
|
||||
# Import `common` only after get_cli_language() runs ensure_sys_path(),
|
||||
# so it works when `cow` is invoked from outside the project directory.
|
||||
get_cli_language() # resolve cow_lang so i18n.t reflects config
|
||||
from common import i18n
|
||||
_t = i18n.t
|
||||
|
||||
skills_dir = get_skills_dir()
|
||||
|
||||
Reference in New Issue
Block a user