From 8db44a78b2eb70792ecd5f75e38a27f0c9fc5fb9 Mon Sep 17 00:00:00 2001 From: YoVinchen Date: Mon, 19 Jan 2026 22:51:50 +0800 Subject: [PATCH] fix(i18n): add providerAdvanced i18n keys and fix failover toast parameter - Add providerAdvanced.* i18n keys to en.json, zh.json, and ja.json - Fix failover toggleFailed toast to pass detail parameter - Remove Chinese fallback text from UI for English/Japanese users --- src-tauri/src/mcp/opencode.rs | 4 +--- src-tauri/src/services/provider/live.rs | 4 +--- src/i18n/locales/en.json | 16 ++++++++++++++++ src/i18n/locales/ja.json | 16 ++++++++++++++++ src/i18n/locales/zh.json | 16 ++++++++++++++++ src/lib/query/failover.ts | 1 + 6 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/mcp/opencode.rs b/src-tauri/src/mcp/opencode.rs index 61257dfcd..687d5797c 100644 --- a/src-tauri/src/mcp/opencode.rs +++ b/src-tauri/src/mcp/opencode.rs @@ -96,9 +96,7 @@ pub fn convert_to_opencode_format(spec: &Value) -> Result { result.insert("enabled".into(), json!(true)); } _ => { - return Err(AppError::McpValidation(format!( - "Unknown MCP type: {typ}" - ))); + return Err(AppError::McpValidation(format!("Unknown MCP type: {typ}"))); } } diff --git a/src-tauri/src/services/provider/live.rs b/src-tauri/src/services/provider/live.rs index 4a16961ac..54ff9d61a 100644 --- a/src-tauri/src/services/provider/live.rs +++ b/src-tauri/src/services/provider/live.rs @@ -500,9 +500,7 @@ pub(crate) fn remove_opencode_provider_from_live(provider_id: &str) -> Result<() // Check if OpenCode config directory exists if !opencode_config::get_opencode_dir().exists() { - log::debug!( - "OpenCode config directory doesn't exist, skipping removal of '{provider_id}'" - ); + log::debug!("OpenCode config directory doesn't exist, skipping removal of '{provider_id}'"); return Ok(()); } diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index d7dbaa729..25b07f0a3 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -450,6 +450,22 @@ "testFailed": "Speed test failed: {{error}}", "status": "Status: {{code}}" }, + "providerAdvanced": { + "testConfig": "Model Test Config", + "useCustomConfig": "Use separate config", + "testConfigDesc": "Configure separate model testing parameters for this provider. Uses global settings when disabled.", + "testModel": "Test Model", + "testModelPlaceholder": "Leave empty to use global config", + "timeoutSecs": "Timeout (seconds)", + "testPrompt": "Test Prompt", + "degradedThreshold": "Degraded Threshold (ms)", + "maxRetries": "Max Retries", + "proxyConfig": "Proxy Config", + "useCustomProxy": "Use separate proxy", + "proxyConfigDesc": "Configure separate network proxy for this provider. Uses system proxy or global settings when disabled.", + "proxyUsername": "Username (optional)", + "proxyPassword": "Password (optional)" + }, "codexConfig": { "authJson": "auth.json (JSON) *", "authJsonPlaceholder": "{\n \"OPENAI_API_KEY\": \"sk-your-api-key-here\"\n}", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index a2c9a2817..1d16de8cf 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -450,6 +450,22 @@ "testFailed": "速度テストに失敗しました: {{error}}", "status": "ステータス: {{code}}" }, + "providerAdvanced": { + "testConfig": "モデルテスト設定", + "useCustomConfig": "個別設定を使用", + "testConfigDesc": "このプロバイダーに個別のモデルテストパラメータを設定します。無効の場合はグローバル設定を使用します。", + "testModel": "テストモデル", + "testModelPlaceholder": "空白の場合はグローバル設定を使用", + "timeoutSecs": "タイムアウト(秒)", + "testPrompt": "テストプロンプト", + "degradedThreshold": "低下閾値(ミリ秒)", + "maxRetries": "最大リトライ回数", + "proxyConfig": "プロキシ設定", + "useCustomProxy": "個別プロキシを使用", + "proxyConfigDesc": "このプロバイダーに個別のネットワークプロキシを設定します。無効の場合はシステムプロキシまたはグローバル設定を使用します。", + "proxyUsername": "ユーザー名(任意)", + "proxyPassword": "パスワード(任意)" + }, "codexConfig": { "authJson": "auth.json (JSON) *", "authJsonPlaceholder": "{\n \"OPENAI_API_KEY\": \"sk-your-api-key-here\"\n}", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 89335af55..5462b38e2 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -450,6 +450,22 @@ "testFailed": "测速失败: {{error}}", "status": "状态码:{{code}}" }, + "providerAdvanced": { + "testConfig": "模型测试配置", + "useCustomConfig": "使用单独配置", + "testConfigDesc": "为此供应商配置单独的模型测试参数,不启用时使用全局配置。", + "testModel": "测试模型", + "testModelPlaceholder": "留空使用全局配置", + "timeoutSecs": "超时时间(秒)", + "testPrompt": "测试提示词", + "degradedThreshold": "降级阈值(毫秒)", + "maxRetries": "最大重试次数", + "proxyConfig": "代理配置", + "useCustomProxy": "使用单独代理", + "proxyConfigDesc": "为此供应商配置单独的网络代理,不启用时使用系统代理或全局设置。", + "proxyUsername": "用户名(可选)", + "proxyPassword": "密码(可选)" + }, "codexConfig": { "authJson": "auth.json (JSON) *", "authJsonPlaceholder": "{\n \"OPENAI_API_KEY\": \"sk-your-api-key-here\"\n}", diff --git a/src/lib/query/failover.ts b/src/lib/query/failover.ts index 87d3d1d5a..10049eb80 100644 --- a/src/lib/query/failover.ts +++ b/src/lib/query/failover.ts @@ -257,6 +257,7 @@ export function useSetAutoFailoverEnabled() { t("common.unknown", { defaultValue: "未知错误" }); toast.error( t("failover.toggleFailed", { + detail, defaultValue: `操作失败: ${detail}`, }), );