From e6f91541a30a68c11daa30a28ff7e517bc387fd2 Mon Sep 17 00:00:00 2001 From: YoVinchen Date: Mon, 26 Jan 2026 01:41:13 +0800 Subject: [PATCH] feat(i18n): add pricing config translations - Add zh/en/ja translations for pricing defaults config - Add translations for multiplier, requestModel, responseModel - Add provider pricing config translations --- src/i18n/locales/en.json | 32 ++++++++++++++++++++++++++++++-- src/i18n/locales/ja.json | 32 ++++++++++++++++++++++++++++++-- src/i18n/locales/zh.json | 32 ++++++++++++++++++++++++++++++-- vitest.config.ts | 2 +- 4 files changed, 91 insertions(+), 7 deletions(-) diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 00c9af3e7..212b3648c 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -344,7 +344,21 @@ "saved": "Proxy settings saved", "saveFailed": "Save failed: {{error}}", "testSuccess": "Connected! Latency {{latency}}ms", - "testFailed": "Connection failed: {{error}}" + "testFailed": "Connection failed: {{error}}", + "pricingDefaultsTitle": "Pricing Defaults", + "pricingDefaultsDescription": "Set the default multiplier and pricing model source per app.", + "pricingAppLabel": "App", + "defaultCostMultiplierLabel": "Default Multiplier", + "defaultCostMultiplierHint": "Multiplier for cost calculation, decimals supported.", + "pricingModelSourceLabel": "Pricing Model Source", + "pricingModelSourceRequest": "Request model", + "pricingModelSourceResponse": "Response model", + "pricingSave": "Save Pricing Defaults", + "pricingSaved": "Pricing defaults saved", + "pricingSaveFailed": "Failed to save pricing defaults: {{error}}", + "pricingLoadFailed": "Failed to load pricing defaults: {{error}}", + "defaultCostMultiplierRequired": "Default multiplier is required", + "defaultCostMultiplierInvalid": "Invalid multiplier format" } }, "apps": { @@ -480,7 +494,18 @@ "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)" + "proxyPassword": "Password (optional)", + "pricingConfig": "Pricing Config", + "useCustomPricing": "Use separate config", + "pricingConfigDesc": "Configure separate pricing parameters for this provider. Uses global defaults when disabled.", + "costMultiplier": "Cost Multiplier", + "costMultiplierPlaceholder": "Leave empty to use global default (1)", + "costMultiplierHint": "Actual cost = Base cost × Multiplier, supports decimals like 1.5", + "pricingModelSourceLabel": "Pricing Mode", + "pricingModelSourceInherit": "Inherit global default", + "pricingModelSourceRequest": "Request model", + "pricingModelSourceResponse": "Response model", + "pricingModelSourceHint": "Choose whether to match pricing by request model or response model" }, "codexConfig": { "authJson": "auth.json (JSON) *", @@ -583,6 +608,9 @@ "cacheCreationTokens": "Cache Creation", "timingInfo": "Duration/TTFT", "status": "Status", + "multiplier": "Multiplier", + "requestModel": "Request Model", + "responseModel": "Response Model", "noData": "No data", "unknownProvider": "Unknown Provider", "stream": "Stream", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index a9254f47b..6acbeb03a 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -344,7 +344,21 @@ "saved": "プロキシ設定を保存しました", "saveFailed": "保存に失敗しました: {{error}}", "testSuccess": "接続成功!遅延 {{latency}}ms", - "testFailed": "接続に失敗しました: {{error}}" + "testFailed": "接続に失敗しました: {{error}}", + "pricingDefaultsTitle": "課金のデフォルト設定", + "pricingDefaultsDescription": "アプリごとのデフォルト倍率と課金モードを設定します。", + "pricingAppLabel": "アプリ", + "defaultCostMultiplierLabel": "デフォルト倍率", + "defaultCostMultiplierHint": "コスト計算用の倍率(小数対応)。", + "pricingModelSourceLabel": "課金モード", + "pricingModelSourceRequest": "リクエストモデル", + "pricingModelSourceResponse": "レスポンスモデル", + "pricingSave": "課金設定を保存", + "pricingSaved": "課金設定を保存しました", + "pricingSaveFailed": "課金設定の保存に失敗しました: {{error}}", + "pricingLoadFailed": "課金設定の読み込みに失敗しました: {{error}}", + "defaultCostMultiplierRequired": "デフォルト倍率は必須です", + "defaultCostMultiplierInvalid": "デフォルト倍率の形式が正しくありません" } }, "apps": { @@ -480,7 +494,18 @@ "useCustomProxy": "個別プロキシを使用", "proxyConfigDesc": "このプロバイダーに個別のネットワークプロキシを設定します。無効の場合はシステムプロキシまたはグローバル設定を使用します。", "proxyUsername": "ユーザー名(任意)", - "proxyPassword": "パスワード(任意)" + "proxyPassword": "パスワード(任意)", + "pricingConfig": "課金設定", + "useCustomPricing": "個別設定を使用", + "pricingConfigDesc": "このプロバイダーに個別の課金パラメータを設定します。無効の場合はグローバル設定を使用します。", + "costMultiplier": "コスト倍率", + "costMultiplierPlaceholder": "空白の場合はグローバル設定を使用(1)", + "costMultiplierHint": "実際のコスト = 基本コスト × 倍率、1.5 などの小数をサポート", + "pricingModelSourceLabel": "課金モード", + "pricingModelSourceInherit": "グローバル設定を継承", + "pricingModelSourceRequest": "リクエストモデル", + "pricingModelSourceResponse": "レスポンスモデル", + "pricingModelSourceHint": "リクエストモデルまたはレスポンスモデルで価格を照合するかを選択" }, "codexConfig": { "authJson": "auth.json (JSON) *", @@ -583,6 +608,9 @@ "cacheCreationTokens": "キャッシュ作成", "timingInfo": "応答時間/TTFT", "status": "ステータス", + "multiplier": "倍率", + "requestModel": "リクエストモデル", + "responseModel": "レスポンスモデル", "noData": "データなし", "unknownProvider": "不明なプロバイダー", "stream": "ストリーム", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index e86c7aae6..21a1cb9f9 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -344,7 +344,21 @@ "saved": "代理设置已保存", "saveFailed": "保存失败:{{error}}", "testSuccess": "连接成功!延迟 {{latency}}ms", - "testFailed": "连接失败:{{error}}" + "testFailed": "连接失败:{{error}}", + "pricingDefaultsTitle": "计费默认配置", + "pricingDefaultsDescription": "设置各应用的默认倍率与计费模式来源。", + "pricingAppLabel": "应用", + "defaultCostMultiplierLabel": "默认倍率", + "defaultCostMultiplierHint": "用于成本计算的倍率,支持小数。", + "pricingModelSourceLabel": "计费模式", + "pricingModelSourceRequest": "请求模型", + "pricingModelSourceResponse": "返回模型", + "pricingSave": "保存计费配置", + "pricingSaved": "计费配置已保存", + "pricingSaveFailed": "保存计费配置失败:{{error}}", + "pricingLoadFailed": "加载计费配置失败:{{error}}", + "defaultCostMultiplierRequired": "默认倍率不能为空", + "defaultCostMultiplierInvalid": "默认倍率格式不正确" } }, "apps": { @@ -480,7 +494,18 @@ "useCustomProxy": "使用单独代理", "proxyConfigDesc": "为此供应商配置单独的网络代理,不启用时使用系统代理或全局设置。", "proxyUsername": "用户名(可选)", - "proxyPassword": "密码(可选)" + "proxyPassword": "密码(可选)", + "pricingConfig": "计费配置", + "useCustomPricing": "使用单独配置", + "pricingConfigDesc": "为此供应商配置单独的计费参数,不启用时使用全局默认配置。", + "costMultiplier": "成本倍率", + "costMultiplierPlaceholder": "留空使用全局默认(1)", + "costMultiplierHint": "实际成本 = 基础成本 × 倍率,支持小数如 1.5", + "pricingModelSourceLabel": "计费模式", + "pricingModelSourceInherit": "继承全局默认", + "pricingModelSourceRequest": "请求模型", + "pricingModelSourceResponse": "返回模型", + "pricingModelSourceHint": "选择按请求模型还是返回模型进行定价匹配" }, "codexConfig": { "authJson": "auth.json (JSON) *", @@ -583,6 +608,9 @@ "cacheCreationTokens": "缓存创建", "timingInfo": "用时/首字", "status": "状态", + "multiplier": "倍率", + "requestModel": "请求模型", + "responseModel": "返回模型", "noData": "暂无数据", "unknownProvider": "未知供应商", "stream": "流", diff --git a/vitest.config.ts b/vitest.config.ts index d99f3f170..c58d0f499 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -11,7 +11,7 @@ export default defineConfig({ }, test: { environment: "jsdom", - setupFiles: ["./tests/setupTests.ts"], + setupFiles: ["./tests/setupGlobals.ts", "./tests/setupTests.ts"], globals: true, coverage: { reporter: ["text", "lcov"],