diff --git a/README.md b/README.md index 4276f23..d686c3d 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,8 @@ pip install uv "env": { "MCP_DEBUG": "false", "MCP_WEB_HOST": "127.0.0.1", - "MCP_WEB_PORT": "8765" + "MCP_WEB_PORT": "8765", + "MCP_LANGUAGE": "en" }, "autoApprove": ["interactive_feedback"] } @@ -172,11 +173,25 @@ follow mcp-feedback-enhanced instructions | `MCP_WEB_HOST` | Web UI host binding | IP address or hostname | `127.0.0.1` | | `MCP_WEB_PORT` | Web UI port | `1024-65535` | `8765` | | `MCP_DESKTOP_MODE` | Desktop application mode | `true`/`false` | `false` | +| `MCP_LANGUAGE` | Force UI language | `zh-TW`/`zh-CN`/`en` | Auto-detect | **`MCP_WEB_HOST` Explanation**: - `127.0.0.1` (default): Local access only, higher security - `0.0.0.0`: Allow remote access, suitable for SSH remote development environments +**`MCP_LANGUAGE` Explanation**: +- Used to force the interface language, overriding automatic system detection +- Supported language codes: + - `zh-TW`: Traditional Chinese + - `zh-CN`: Simplified Chinese + - `en`: English +- Language detection priority: + 1. User-saved language settings in the interface (highest priority) + 2. `MCP_LANGUAGE` environment variable + 3. System environment variables (LANG, LC_ALL, etc.) + 4. System default language + 5. Fallback to default language (Traditional Chinese) + ### Testing Options ```bash # Version check @@ -188,6 +203,11 @@ uvx mcp-feedback-enhanced@latest test --desktop # Test desktop application (v2.5 # Debug mode MCP_DEBUG=true uvx mcp-feedback-enhanced@latest test + +# Specify language for testing +MCP_LANGUAGE=en uvx mcp-feedback-enhanced@latest test --web # Force English interface +MCP_LANGUAGE=zh-TW uvx mcp-feedback-enhanced@latest test --web # Force Traditional Chinese +MCP_LANGUAGE=zh-CN uvx mcp-feedback-enhanced@latest test --web # Force Simplified Chinese ``` ### Developer Installation diff --git a/README.zh-CN.md b/README.zh-CN.md index e8f52a2..c208642 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -122,7 +122,8 @@ pip install uv "env": { "MCP_DEBUG": "false", "MCP_WEB_HOST": "127.0.0.1", - "MCP_WEB_PORT": "8765" + "MCP_WEB_PORT": "8765", + "MCP_LANGUAGE": "zh-CN" }, "autoApprove": ["interactive_feedback"] } @@ -172,11 +173,25 @@ pip install uv | `MCP_WEB_HOST` | Web UI 主机绑定 | IP 地址或主机名 | `127.0.0.1` | | `MCP_WEB_PORT` | Web UI 端口 | `1024-65535` | `8765` | | `MCP_DESKTOP_MODE` | 桌面应用程序模式 | `true`/`false` | `false` | +| `MCP_LANGUAGE` | 强制指定界面语言 | `zh-TW`/`zh-CN`/`en` | 自动检测 | **`MCP_WEB_HOST` 说明**: - `127.0.0.1`(默认):仅本地访问,安全性较高 - `0.0.0.0`:允许远程访问,适用于 SSH 远程开发环境 +**`MCP_LANGUAGE` 说明**: +- 用于强制指定界面语言,覆盖系统自动检测 +- 支持的语言代码: + - `zh-TW`:繁体中文 + - `zh-CN`:简体中文 + - `en`:英文 +- 语言检测优先顺序: + 1. 用户在界面中保存的语言设定(最高优先级) + 2. `MCP_LANGUAGE` 环境变量 + 3. 系统环境变量(LANG、LC_ALL 等) + 4. 系统默认语言 + 5. 回退到默认语言(繁体中文) + ### 测试选项 ```bash # 版本查询 @@ -188,6 +203,11 @@ uvx mcp-feedback-enhanced@latest test --desktop # 测试桌面应用程序 (v2.5 # 调试模式 MCP_DEBUG=true uvx mcp-feedback-enhanced@latest test + +# 指定语言测试 +MCP_LANGUAGE=en uvx mcp-feedback-enhanced@latest test --web # 强制使用英文界面 +MCP_LANGUAGE=zh-TW uvx mcp-feedback-enhanced@latest test --web # 强制使用繁体中文 +MCP_LANGUAGE=zh-CN uvx mcp-feedback-enhanced@latest test --web # 强制使用简体中文 ``` ### 开发者安装 diff --git a/README.zh-TW.md b/README.zh-TW.md index c741960..ee11ce5 100644 --- a/README.zh-TW.md +++ b/README.zh-TW.md @@ -122,7 +122,8 @@ pip install uv "env": { "MCP_DEBUG": "false", "MCP_WEB_HOST": "127.0.0.1", - "MCP_WEB_PORT": "8765" + "MCP_WEB_PORT": "8765", + "MCP_LANGUAGE": "zh-TW" }, "autoApprove": ["interactive_feedback"] } @@ -172,11 +173,25 @@ pip install uv | `MCP_WEB_HOST` | Web UI 主機綁定 | IP 地址或主機名 | `127.0.0.1` | | `MCP_WEB_PORT` | Web UI 端口 | `1024-65535` | `8765` | | `MCP_DESKTOP_MODE` | 桌面應用程式模式 | `true`/`false` | `false` | +| `MCP_LANGUAGE` | 強制指定介面語言 | `zh-TW`/`zh-CN`/`en` | 自動偵測 | **`MCP_WEB_HOST` 說明**: - `127.0.0.1`(預設):僅本地存取,安全性較高 - `0.0.0.0`:允許遠端存取,適用於 SSH 遠端開發環境 +**`MCP_LANGUAGE` 說明**: +- 用於強制指定介面語言,覆蓋系統自動偵測 +- 支援的語言代碼: + - `zh-TW`:繁體中文 + - `zh-CN`:簡體中文 + - `en`:英文 +- 語言偵測優先順序: + 1. 用戶在介面中保存的語言設定(最高優先級) + 2. `MCP_LANGUAGE` 環境變數 + 3. 系統環境變數(LANG、LC_ALL 等) + 4. 系統預設語言 + 5. 回退到預設語言(繁體中文) + ### 測試選項 ```bash # 版本查詢 @@ -188,6 +203,11 @@ uvx mcp-feedback-enhanced@latest test --desktop # 測試桌面應用程式 (v2.5 # 調試模式 MCP_DEBUG=true uvx mcp-feedback-enhanced@latest test + +# 指定語言測試 +MCP_LANGUAGE=en uvx mcp-feedback-enhanced@latest test --web # 強制使用英文介面 +MCP_LANGUAGE=zh-TW uvx mcp-feedback-enhanced@latest test --web # 強制使用繁體中文 +MCP_LANGUAGE=zh-CN uvx mcp-feedback-enhanced@latest test --web # 強制使用簡體中文 ``` ### 開發者安裝 diff --git a/src/mcp_feedback_enhanced/i18n.py b/src/mcp_feedback_enhanced/i18n.py index 2e334a1..bfc678f 100644 --- a/src/mcp_feedback_enhanced/i18n.py +++ b/src/mcp_feedback_enhanced/i18n.py @@ -31,7 +31,7 @@ class I18nManager: self._current_language = None self._translations = {} self._supported_languages = ["zh-CN", "zh-TW", "en"] - self._fallback_language = "zh-CN" + self._fallback_language = "zh-TW" self._config_file = self._get_config_file_path() self._locales_dir = Path(__file__).parent / "web" / "locales" @@ -139,7 +139,7 @@ class I18nManager: def get_current_language(self) -> str: """獲取當前語言""" - return self._current_language or "zh-CN" + return self._current_language or "zh-TW" def set_language(self, language: str) -> bool: """設定語言"""