import { createContext, useContext, useMemo } from "react";
import { translateErrorMessage } from "@ccr/core/contracts/i18n";

type NavigationId = "onboarding" | "overview" | "observability" | "api-keys" | "server" | "profile" | "networking" | "logs" | "providers" | "models" | "routing" | "virtual-models" | "extensions";
type ResolvedLanguage = "en" | "zh";

export type AppCopy = {
  navigation: Record<NavigationId, string>;
  settings: {
    agentAnalysis: string;
    agentAnalysisDescription: string;
    appearance: string;
    bots: string;
    button: string;
    close: string;
    data: string;
    done: string;
    general: string;
    language: string;
    languageChinese: string;
    languageEnglish: string;
    languageSystem: string;
    launchAtLogin: string;
    launchAtLoginDescription: string;
    observability: string;
    proxy: string;
    requestLogs: string;
    requestLogsDescription: string;
    theme: string;
    themeDark: string;
    themeLight: string;
    themeSystem: string;
    toolHub: string;
    toolHubBrowserAutomation: string;
    toolHubBrowserAutomationDescription: string;
    toolHubDescription: string;
    toolHubEnabled: string;
    toolHubEnabledDescription: string;
    toolHubMaxTools: string;
    toolHubModel: string;
    toolHubModelPlaceholder: string;
    toolHubTimeout: string;
    tray: string;
    trayBalanceProgressAccount: string;
    trayBalanceProgressData: string;
    trayBalanceProgressNoData: string;
    trayBalanceProgressRequired: string;
    trayIcon: string;
    trayIconCyan: string;
    trayIconOrange: string;
    trayIconProgress: string;
    trayIconRandom: string;
    trayIconViolet: string;
    trayComponentAccount: string;
    trayComponentArc: string;
    trayComponentArea: string;
    trayComponentBar: string;
    trayComponentBars: string;
    trayComponentCards: string;
    trayComponentCompact: string;
    trayComponentDonut: string;
    trayComponentFlow: string;
    trayComponentGauges: string;
    trayComponentLine: string;
    trayComponentList: string;
    trayComponentModelShare: string;
    trayComponentPie: string;
    trayComponentPills: string;
    trayComponentRing: string;
    trayComponentRings: string;
    trayComponentSparkline: string;
    trayComponentStacked: string;
    trayComponentStats: string;
    trayComponentStyles: string;
    trayComponentEnabled: string;
    trayComponentProperties: string;
    trayComponentStyle: string;
    trayComponents: string;
    trayComponentTokenMix: string;
    trayModuleActivity: string;
    trayModuleAccount: string;
    trayModuleFooter: string;
    trayModuleHeader: string;
    trayModuleModelShare: string;
    trayModuleRings: string;
    trayModuleSourceTabs: string;
    trayModuleStats: string;
    trayModuleTokenFlow: string;
    trayModuleTokenMix: string;
    trayPreview: string;
    trayPreviewEmpty: string;
    trayProgressTarget: string;
    trayWindowModules: string;
    title: string;
  };
  sidebar: {
    collapse: string;
    expand: string;
    primaryNavigation: string;
  };
  text: Record<string, string>;
};

export const languagePreferenceStorageKey = "ccr.ui.language";

export const appCopy: Record<ResolvedLanguage, AppCopy> = {
  en: {
    navigation: {
      onboarding: "Onboarding",
      "api-keys": "API Keys",
      extensions: "Extensions",
      logs: "Logs",
      networking: "Networking",
      observability: "Observability",
      overview: "Overview",
      profile: "Agent Config",
      providers: "Providers",
      models: "Models",
      routing: "Routing",
      server: "Server",
      "virtual-models": "Fusion"
    },
    settings: {
      agentAnalysis: "Agent observability",
      agentAnalysisDescription: "Record request metadata needed for the observability page.",
      appearance: "Appearance",
      bots: "Bots",
      button: "Settings",
      close: "Close",
      data: "Data",
      done: "Done",
      general: "General",
      language: "Language",
      languageChinese: "Chinese",
      languageEnglish: "English",
      languageSystem: "System",
      launchAtLogin: "Launch at login",
      launchAtLoginDescription: "Open Claude Code Router automatically when you sign in to this computer.",
      observability: "Logs & Observability",
      proxy: "Proxy",
      requestLogs: "Request logs",
      requestLogsDescription: "Record gateway requests and show the Logs page.",
      theme: "Theme",
      themeDark: "Dark",
      themeLight: "Light",
      themeSystem: "System",
      toolHub: "ToolHub",
      toolHubBrowserAutomation: "Built-in browser automation",
      toolHubBrowserAutomationDescription: "Expose CCR Desktop's built-in browser automation tools through ToolHub.",
      toolHubDescription: "Route configured MCP servers through ToolHub, where the model finds the tools needed for each task.",
      toolHubEnabled: "Enable ToolHub",
      toolHubEnabledDescription: "Expose a compact ToolHub MCP server instead of all configured MCP tools.",
      toolHubMaxTools: "Max tools",
      toolHubModel: "Resolver model",
      toolHubModelPlaceholder: "Select a configured model",
      toolHubTimeout: "Timeout ms",
      tray: "Tray",
      trayBalanceProgressAccount: "Account",
      trayBalanceProgressData: "Data",
      trayBalanceProgressNoData: "No account data is available. Enable account monitoring on a provider first.",
      trayBalanceProgressRequired: "Choose an account and data to enable balance progress.",
      trayIcon: "Tray mascot",
      trayIconCyan: "Auralis",
      trayIconOrange: "Solara",
      trayIconProgress: "Balance progress",
      trayIconRandom: "Random",
      trayIconViolet: "Vesper",
      trayComponentAccount: "Account meter",
      trayComponentArc: "Arc",
      trayComponentArea: "Area",
      trayComponentBar: "Bar",
      trayComponentBars: "Bars",
      trayComponentCards: "Cards",
      trayComponentCompact: "Compact",
      trayComponentDonut: "Donut",
      trayComponentFlow: "Flow chart",
      trayComponentGauges: "Gauges",
      trayComponentLine: "Line",
      trayComponentList: "List",
      trayComponentModelShare: "Model share",
      trayComponentPie: "Pie",
      trayComponentPills: "Pills",
      trayComponentRing: "Ring",
      trayComponentRings: "Rings",
      trayComponentSparkline: "Sparkline",
      trayComponentStacked: "Stacked",
      trayComponentStats: "Stats",
      trayComponentStyles: "Component styles",
      trayComponentEnabled: "Enabled",
      trayComponentProperties: "Component properties",
      trayComponentStyle: "Style",
      trayComponents: "Components",
      trayComponentTokenMix: "Token mix",
      trayModuleActivity: "Token activity",
      trayModuleAccount: "Account balance",
      trayModuleFooter: "Footer actions",
      trayModuleHeader: "Title and status",
      trayModuleModelShare: "Model share",
      trayModuleRings: "Circular metrics",
      trayModuleSourceTabs: "Provider tabs",
      trayModuleStats: "Token stats",
      trayModuleTokenFlow: "Token flow chart",
      trayModuleTokenMix: "Token mix",
      trayPreview: "Preview",
      trayPreviewEmpty: "No tray modules enabled",
      trayProgressTarget: "Progress target",
      trayWindowModules: "Tray window modules",
      title: "Settings"
    },
    sidebar: {
      collapse: "Collapse sidebar",
      expand: "Expand sidebar",
      primaryNavigation: "Primary navigation"
    },
    text: {
      "上一页": "Previous page",
      "下一页": "Next page",
      "全部状态": "All statuses",
      "成功": "Success",
      "错误": "Error",
      "时间": "Time",
      "状态": "Status",
      "模型": "Model",
      "Stream": "Stream",
      "Streaming": "Streaming",
      "Non-streaming": "Non-streaming",
      "令牌": "Tokens",
      "成本": "Cost",
      "持续时间": "Duration",
      "反馈": "Feedback",
      "Failed requests": "Failed requests",
      "输入": "Input",
      "输出": "Output",
      "缓存读取": "Cache read",
      "缓存写入": "Cache write",
      "总计": "Total",
      "请求": "Request",
      "响应": "Response",
      "复制": "Copy",
      "筛选日志、模型、请求或响应": "Filter logs, models, requests, or responses",
      "全部供应商": "All providers",
      "全部模型": "All models",
      "正在加载日志": "Loading logs",
      "暂无日志": "No logs",
      "No request headers": "No request headers",
      "No response headers": "No response headers",
      "筛选 JSON...": "Filter JSON...",
      "body": "Body",
      "header": "Headers",
      "入": "in",
      "出": "out",
      "No provider presets found": "No provider presets found",
      "After you enter the API endpoint and key, the system will automatically detect supported protocols and available models.": "After you enter the API endpoint and key, the system will automatically detect supported protocols and available models.",
      "Back": "Back",
      "Available models": "Available models",
      "Check": "Check",
      "Check Connection": "Check Connection",
      "Check results": "Check results",
      "Checking connection": "Checking connection",
      "Click Check Connection to verify connectivity with a real model request.": "Click Check Connection to verify connectivity with a real model request.",
      "Connection verified": "Connection verified",
      "CCR scanned this computer for Claude Code, Codex, Grok CLI, OpenCode CLI, and ZCode login states. Click Import to add one as a gateway provider.": "CCR scanned this computer for Claude Code, Codex, Grok CLI, OpenCode CLI, and ZCode login states. Click Import to add one as a gateway provider.",
      "Detected": "Detected",
      "Detecting protocols": "Detecting protocols",
      "Enter API endpoint, API key, and at least one model to enable connectivity check.": "Enter API endpoint, API key, and at least one model to enable connectivity check.",
      "Generated output is limited to 1 token for connectivity checks.": "Generated output is limited to 1 token for connectivity checks.",
      "Import local agent login": "Import local agent login",
      "Import local agent provider": "Import local agent provider",
      "ChatGPT login detected. Click Import to add it as a gateway provider.": "ChatGPT login detected. Click Import to add it as a gateway provider.",
      "Claude Code login detected. Click Import to add it as a gateway provider.": "Claude Code login detected. Click Import to add it as a gateway provider.",
      "Claude Code login was detected, but no usable access token was found.": "Claude Code login was detected, but no usable access token was found.",
      "Codex auth file was found, but no usable token was detected.": "Codex auth file was found, but no usable token was detected.",
      "Claude Code credential file was found, but no usable OAuth token was detected.": "Claude Code credential file was found, but no usable OAuth token was detected.",
      "Grok CLI login detected. Click Import to add it as a gateway provider.": "Grok CLI login detected. Click Import to add it as a gateway provider.",
      "Grok CLI login was detected, but no usable access token was found.": "Grok CLI login was detected, but no usable access token was found.",
      "Grok CLI login was detected, but the access token is expired. Run grok login again, then rescan.": "Grok CLI login was detected, but the access token is expired. Run grok login again, then rescan.",
      "OpenCode CLI credential was found, but no usable API key was detected.": "OpenCode CLI credential was found, but no usable API key was detected.",
      "OpenCode CLI login detected. Click Import to add it as a gateway provider.": "OpenCode CLI login detected. Click Import to add it as a gateway provider.",
      "OpenCode CLI public models detected. No login is required.": "OpenCode CLI public models detected. No login is required.",
      "CCR scanned this computer for local Claude Code, Codex, Grok CLI, OpenCode CLI, and ZCode providers. Click Import to add one as a gateway provider.": "CCR scanned this computer for local Claude Code, Codex, Grok CLI, OpenCode CLI, and ZCode providers. Click Import to add one as a gateway provider.",
      "Locked": "Locked",
      "Local agent login will be connected after saving this provider.": "Local agent login will be connected after saving this provider.",
      "Models to check": "Models to check",
      "No available models": "No available models",
      "No local login state was found for this agent.": "No local login state was found for this agent.",
      "Not found": "Not found",
      "No unavailable models": "No unavailable models",
      "Press Enter to add": "Press Enter to add",
      "Protocols detected": "Protocols detected",
      "Ready": "Ready",
      "Select at least one protocol.": "Select at least one protocol.",
      "Service": "Service",
      "Service failed to start": "Service failed to start",
      "Scanning local agent logins": "Scanning local agent logins",
      "Start": "Start",
      "Start check": "Start check",
      "Stop": "Stop",
      "This check sends real model requests with your provider API key and may consume account balance.": "This check sends real model requests with your provider API key and may consume account balance.",
      "ZCode login detected. Click Import to add it as a gateway provider.": "ZCode login detected. Click Import to add it as a gateway provider.",
      "ZCode login was detected, but its local credential is encrypted and cannot be imported automatically.": "ZCode login was detected, but its local credential is encrypted and cannot be imported automatically.",
      "ZCode login was detected, but no usable provider API key was found in ZCode config.": "ZCode login was detected, but no usable provider API key was found in ZCode config.",
      "ZCode provider API key detected in local ZCode config. Click Import to add it as a gateway provider.": "ZCode provider API key detected in local ZCode config. Click Import to add it as a gateway provider.",
      "Unavailable models": "Unavailable models",
      "Account Balance": "Account Balance",
      "Account component": "Account component",
      "All accounts": "All accounts",
      "All credentials": "All credentials",
      "Last updated": "Last updated",
      "Refresh account": "Refresh account",
      "Refreshing account": "Refreshing account",
      "Add widget": "Add widget",
      "Analysis component": "Analysis component",
      "Arc": "Arc",
      "Area": "Area",
      "Average latency": "Average latency",
      "Bar": "Bar",
      "Bars": "Bars",
      "Breakdown component": "Breakdown component",
      "Card": "Card",
      "Cards": "Cards",
      "Change widget type": "Change widget type",
      "Client Analysis": "Client Analysis",
      "Component properties": "Component properties",
      "Components": "Components",
      "Component category": "Component category",
      "Compact": "Compact",
      "Composed": "Composed",
      "Client or provider": "Client or provider",
      "Data": "Data",
      "Done": "Done",
      "Donut": "Donut",
      "Drag cards to arrange": "Drag cards to arrange",
      "Drag to move": "Drag to move",
      "Edit widgets": "Edit widgets",
      "Full": "Full",
      "Header component": "Header component",
      "Large": "Large",
      "Line": "Line",
      "Medium": "Medium",
      "Metric": "Metric",
      "Metric component": "Metric component",
      "Model Distribution": "Model Distribution",
      "Model distribution": "Model distribution",
      "Move down": "Move down",
      "Move up": "Move up",
      "Nested rings": "Nested rings",
      "No model activity": "No model activity",
      "No widget selected": "No widget selected",
      "No widgets configured": "No widgets configured",
      "Overview layout": "Overview layout",
      "Overview": "Overview",
      "Other": "Other",
      "Pie": "Pie",
      "Provider Analysis": "Provider Analysis",
      "Provider component": "Provider component",
      "Preview": "Preview",
      "Requests, tokens, cost": "Requests, tokens, cost",
      "Remove widget": "Remove widget",
      "Reset layout": "Reset layout",
      "Close fullscreen JSON viewer": "Close fullscreen JSON viewer",
      "Fullscreen JSON viewer": "Fullscreen JSON viewer",
      "Open fullscreen JSON viewer": "Open fullscreen JSON viewer",
      "Resize column width": "Resize column width",
      "Resize widget height": "Resize widget height",
      "Resize widget size": "Resize widget size",
      "Resize widget width": "Resize widget width",
      "Ring": "Ring",
      "Semicircle": "Semicircle",
      "Small": "Small",
      "Stacked": "Stacked",
      "Status component": "Status component",
      "Status timeline": "Status timeline",
      "Style": "Style",
      "Table": "Table",
      "Timeline": "Timeline",
      "Token distribution": "Token distribution",
      "Token or model distribution": "Token or model distribution",
      "Token mix, rings, model share": "Token mix, rings, model share",
      "Token mix component": "Token mix component",
      "Trend component": "Trend component",
      "Usage over time": "Usage over time",
      "Widget": "Widget",
      "Widget size": "Widget size",
      "Wide": "Wide",
      "Share cards": "Share cards",
      "Share card": "Share card",
      "Save social-ready cards as PNG images": "Save social-ready cards as PNG images",
      "Social media PNG cards": "Social media PNG cards",
      "PNG export": "PNG export",
      "Save image": "Save image",
      "Saving": "Saving",
      "Export failed": "Export failed",
      "AI Usage Wrapped": "AI Usage Wrapped",
      "CCR Route Map": "CCR Route Map",
      "Model Leaderboard": "Model Leaderboard",
      "AI Fuel Cockpit": "AI Fuel Cockpit",
      "Token Calendar Poster": "Token Calendar Poster",
      "Spend Receipt": "Spend Receipt",
      "tokens routed through CCR": "tokens routed through CCR",
      "Top model": "Top model",
      "Top provider": "Top provider",
      "No provider activity": "No provider activity",
      "Peak day": "Peak day",
      "Generated by CCR": "Generated by CCR",
      "Range": "Range",
      "Virtual model": "Fusion",
      "Virtual Models": "Fusion",
      "Add Virtual Model": "Add Fusion",
      "Add virtual model": "Add Fusion",
      "Edit Virtual Model": "Edit Fusion",
      "Edit virtual model": "Edit Fusion",
      "Fusion combines a model with another model or tools into a new model.": "Fusion combines a model with another model or tools into a new model.",
      "Fusion example": "Example: GLM 5.2 + GLM 5V Turbo = GLM 5.2V",
      "Vision tool configuration": "Vision tool configuration",
      "Choose a configured gateway model for image understanding.": "Choose a configured gateway model for image understanding.",
      "Vision model": "Vision model",
      "Vision model is required.": "Vision model is required.",
      "Web search configuration": "Web search configuration",
      "Search provider": "Search provider",
      "In-app Browser": "In-app Browser",
      "Provider configuration": "Provider configuration",
      "Search engine": "Search engine",
      "Safe search": "Safe search",
      "Language": "Language",
      "Country": "Country",
      "Advanced variables": "Advanced variables",
      "Default": "Default",
      "Moderate": "Moderate",
      "Strict": "Strict",
      "Off": "Off",
	      "Add tool": "Add tool",
	      "Add variable": "Add variable",
	      "Add custom MCP": "Add custom MCP",
	      "Add custom MCP tool": "Add custom MCP tool",
	      "Custom MCP tool": "Custom MCP tool",
	      "Discover tools": "Discover tools",
      "Import MCP JSON": "Import MCP JSON",
      "MCP JSON": "MCP JSON",
	      "MCP tools": "MCP tools",
	      "MCP server": "MCP server",
      "MCP server name already exists.": "MCP server name already exists.",
      "Arguments": "Arguments",
      "Working directory": "Working directory",
      "API key env": "API key env",
      "CLAUDE_APP_PATH": "CLAUDE_APP_PATH",
      "CHATGPT_APP_PATH": "CHATGPT_APP_PATH",
      "OPENCODE_APP_PATH": "OPENCODE_APP_PATH",
      "Drop the app here or paste the executable path": "Drop the app here or paste the executable path",
      "Tool name": "Tool name",
      "Third-party tool environment": "Third-party tool environment",
      "Environment variables": "Environment variables",
      "Tool name is required.": "Tool name is required.",
	      "Environment variable keys are required when values are set.": "Environment variable keys are required when values are set.",
	      "MCP tool discovery is available in the Electron app.": "MCP tool discovery is available in the Electron app.",
      "No MCP servers found in JSON.": "No MCP servers found in JSON.",
	      "No MCP servers configured": "No MCP servers configured",
	      "No tools discovered": "No tools discovered",
	      "No tools available": "No tools available",
	      "Select tool": "Select tool",
	      "Tool discovery failed": "Tool discovery failed",
	      "Image recognition": "Image recognition",
      "Image recognition and Web Search": "Image recognition and Web Search",
      "Generic image understanding tool for OCR, screenshot analysis, chart reading, UI comparison, error diagnosis, and other multi-image tasks.": "Generic image understanding tool for OCR, screenshot analysis, chart reading, UI comparison, error diagnosis, and other multi-image tasks.",
      "Generic web search tool supporting Brave, Bing, Google CSE, Serper, SerpAPI, Tavily, and Exa.": "Generic web search tool supporting Brave, Bing, Google CSE, Serper, SerpAPI, Tavily, and Exa.",
      "Generic web search tool supporting hidden in-app browser search plus Brave, Bing, Google CSE, Serper, SerpAPI, Tavily, and Exa.": "Generic web search tool supporting hidden in-app browser search plus Brave, Bing, Google CSE, Serper, SerpAPI, Tavily, and Exa.",
      "Web Search": "Web Search",
      "New model": "New model",
      "New model is required.": "New model is required.",
      "Base model is required.": "Base model is required.",
      "Tool is required.": "Tool is required.",
      "No matching virtual models": "No matching Fusion profiles",
      "No virtual models configured": "No Fusion profiles configured",
      "Remove virtual model": "Remove Fusion",
      "Search virtual models": "Search Fusion",
      "Virtual": "Fusion",
      "Virtual models": "Fusion",
      "Header中未收到Authorization参数，无法进行身份验证。": "Missing Authorization header, so authentication could not be performed."
    }
  },
  zh: {
    navigation: {
      onboarding: "上手引导",
      "api-keys": "API 密钥",
      extensions: "扩展",
      logs: "日志",
      networking: "网络",
      observability: "观测",
      overview: "概览",
      profile: "Agent配置",
      providers: "供应商",
      models: "模型",
      routing: "路由",
      server: "服务",
      "virtual-models": "Fusion"
    },
    settings: {
      agentAnalysis: "Agent 观测",
      agentAnalysisDescription: "记录观测页所需的请求元数据。",
      appearance: "外观",
      bots: "Bot 管理",
      button: "设置",
      close: "关闭",
      data: "数据",
      done: "完成",
      general: "通用",
      language: "语言",
      languageChinese: "中文",
      languageEnglish: "英文",
      languageSystem: "跟随系统",
      launchAtLogin: "开机自启",
      launchAtLoginDescription: "登录系统后自动打开 Claude Code Router。",
      observability: "日志与观测",
      proxy: "代理",
      requestLogs: "请求日志",
      requestLogsDescription: "记录网关请求并显示日志页。",
      theme: "主题",
      themeDark: "暗色",
      themeLight: "亮色",
      themeSystem: "跟随系统",
      toolHub: "ToolHub",
      toolHubBrowserAutomation: "内置浏览器自动化",
      toolHubBrowserAutomationDescription: "通过 ToolHub 暴露 CCR Desktop 的内置浏览器自动化工具。",
      toolHubDescription: "将已配置的 MCP servers 交给 ToolHub，由模型负责检索需要的工具。",
      toolHubEnabled: "启用 ToolHub",
      toolHubEnabledDescription: "向 Agent 暴露紧凑的 ToolHub MCP，而不是所有已配置 MCP 工具。",
      toolHubMaxTools: "最大工具数",
      toolHubModel: "检索模型",
      toolHubModelPlaceholder: "选择已配置模型",
      toolHubTimeout: "超时毫秒",
      tray: "Tray",
      trayBalanceProgressAccount: "账户",
      trayBalanceProgressData: "数据",
      trayBalanceProgressNoData: "暂无可用账户数据，请先为供应商启用账户监控。",
      trayBalanceProgressRequired: "请选择账户和数据后启用余额进度条。",
      trayIcon: "托盘小精灵",
      trayIconCyan: "晴岚",
      trayIconOrange: "暖阳",
      trayIconProgress: "余额进度条",
      trayIconRandom: "随机",
      trayIconViolet: "星澜",
      trayComponentAccount: "账户指标",
      trayComponentArc: "弧形",
      trayComponentArea: "面积图",
      trayComponentBar: "柱状图",
      trayComponentBars: "横条",
      trayComponentCards: "卡片",
      trayComponentCompact: "紧凑",
      trayComponentDonut: "环形图",
      trayComponentFlow: "趋势图",
      trayComponentGauges: "仪表盘",
      trayComponentLine: "折线图",
      trayComponentList: "列表",
      trayComponentModelShare: "模型占比",
      trayComponentPie: "饼图",
      trayComponentPills: "胶囊",
      trayComponentRing: "圆环",
      trayComponentRings: "圆环",
      trayComponentSparkline: "迷你折线",
      trayComponentStacked: "堆叠",
      trayComponentStats: "指标",
      trayComponentStyles: "组件样式",
      trayComponentEnabled: "启用组件",
      trayComponentProperties: "组件属性",
      trayComponentStyle: "样式",
      trayComponents: "组件区",
      trayComponentTokenMix: "Token 构成",
      trayModuleActivity: "Token 活跃度",
      trayModuleAccount: "账户余额",
      trayModuleFooter: "底部操作",
      trayModuleHeader: "标题和状态",
      trayModuleModelShare: "模型占比",
      trayModuleRings: "环形指标",
      trayModuleSourceTabs: "供应商切换",
      trayModuleStats: "Token 指标",
      trayModuleTokenFlow: "Token 趋势图",
      trayModuleTokenMix: "Token 构成",
      trayPreview: "预览",
      trayPreviewEmpty: "未启用 Tray 模块",
      trayProgressTarget: "进度目标",
      trayWindowModules: "Tray 窗口模块",
      title: "设置"
    },
    sidebar: {
      collapse: "收起侧边栏",
      expand: "展开侧边栏",
      primaryNavigation: "主导航"
    },
    text: {
      "24h": "24 小时",
      "7d": "7 天",
      "30d": "30 天",
      "Agent": "Agent",
      "A provider is required before profiles can route traffic.": "需要先配置供应商，配置档案才能路由请求。",
      "Add or verify a model provider.": "添加或确认模型供应商。",
      "Agent Analysis": "Agent 分析",
      "Agent access": "Agent 接入",
      "Agent Mix": "Agent 分布",
      "Agent profiles": "Agent 配置档案",
      "All agents": "全部 Agent",
      "All models": "全部模型",
      "All providers": "全部供应商",
      "API key": "API 密钥",
      "API key created": "API 密钥已创建",
      "API keys database": "API 密钥数据库",
      "Copy this key now. It may not be shown again.": "请现在复制保存这个密钥，之后可能不会再次完整显示。",
      "Add": "添加",
      "Add env variable": "添加环境变量",
      "Add header": "添加请求头",
      "Add API Key": "添加 API 密钥",
      "Add API key": "添加 API 密钥",
      "Add key": "添加 Key",
      "Add limit": "添加限制",
      "Add parameter": "添加参数",
      "Add Profile": "添加配置",
      "Add profile": "添加配置",
      "Add Provider": "添加供应商",
      "Add provider": "添加供应商",
      "Add bot": "添加 Bot",
      "Add new bot": "添加新 Bot",
      "Add Routing Rule": "添加路由规则",
      "Add routing rule": "添加路由规则",
      "Advanced Settings...": "高级设置...",
      "Advanced key options": "Key 高级选项",
      "Advanced settings": "高级设置",
      "Always": "始终",
      "Alias": "别名",
      "Alias is required.": "别名不能为空。",
      "Applied": "已应用",
      "App only": "仅 App",
      "Args": "参数",
      "API Keys": "API 密钥",
      "API key included": "已包含 API 密钥",
      "API key not included": "未包含 API 密钥",
      "API key persistence is only available in the Electron app.": "API Key 持久化仅在 Electron App 中可用。",
      "Acknowledge events": "确认事件",
      "Auth type": "认证类型",
      "Auth method": "认证方式",
      "Auto start integration": "自动启动集成",
      "Base URL": "基础 URL",
      "Bot": "Bot",
      "Bot name, platform, and required authentication fields are required.": "Bot 名称、平台和必填认证字段不能为空。",
      "Bot gateway path": "Bot 网关路径",
      "Weixin iLink": "微信",
      "WeCom": "企业微信",
      "Feishu": "飞书",
      "DingTalk": "钉钉",
      "QR Login": "扫码登录",
      "Weixin Login": "微信登录",
      "Weixin QR code": "微信二维码",
      "QR login is available in the Electron app.": "扫码登录仅在 Electron App 中可用。",
      "QR window is available in the Electron app.": "二维码窗口仅在 Electron App 中可用。",
      "QR scan timed out.": "扫码超时。",
      "QR scan observation failed.": "扫码状态观测失败。",
      "QR scan observation ended unexpectedly.": "扫码状态观测异常结束。",
      "Preparing Weixin login.": "正在准备微信登录。",
      "QR login canceled.": "扫码登录已取消。",
      "Weixin login requires a web login URL.": "微信登录需要网页形式的登录地址。",
      "Generate QR code": "生成二维码",
      "Generating QR code": "正在生成二维码",
      "Open QR window": "打开二维码窗口",
      "Scan the QR code in Weixin.": "请使用微信扫描二维码。",
      "Scan with Weixin to connect this bot.": "使用微信扫码连接这个 Bot。",
      "Scan with Weixin in the opened window.": "请在打开的窗口中使用微信扫码。",
      "Weixin login window closed, confirming login status.": "微信登录窗口已关闭，正在确认登录状态。",
      "Waiting for QR code": "等待生成二维码",
      "Waiting for scan": "等待扫码",
      "Scanned, confirm on phone": "已扫码，请在手机上确认",
      "Verification required": "需要验证码",
      "Connected": "已连接",
      "QR code expired": "二维码已过期",
      "Already connected": "已连接过",
      "QR login failed": "扫码登录失败",
      "Regenerate": "重新生成",
      "Bot Token": "Bot Token",
      "Account ID": "账号 ID",
      "User ID": "用户 ID",
      "Corp ID": "企业 ID",
      "Agent ID": "Agent ID",
      "Secret": "Secret",
      "Signing Secret": "Signing Secret",
      "App Token": "App Token",
      "OAuth 2.0": "OAuth 2.0",
      "OAuth Bot Token": "OAuth Bot Token",
      "OAuth Access Token": "OAuth Access Token",
      "Application ID": "应用 ID",
      "Public Key": "公钥",
      "Channel Access Token": "Channel Access Token",
      "Channel Secret": "Channel Secret",
      "App ID": "App ID",
      "App Secret": "App Secret",
      "Verification Token": "Verification Token",
      "Domain": "Domain",
      "App Key": "App Key",
      "Robot Code": "Robot Code",
      "Optional": "可选",
      "Auto": "自动",
      "Back": "返回",
      "Backup": "备份",
      "Cache": "缓存",
      "Cache rate": "缓存率",
      "Cache ratio": "缓存率",
      "Cache tokens": "缓存令牌",
      "Cache write": "缓存写入",
      "Cancel": "取消",
      "Channel": "频道",
      "Check": "检查",
      "Check Connection": "检测连通性",
      "Checking connection": "正在检测连通性",
      "Check for updates": "检查更新",
      "Checking for updates": "正在检查更新",
      "Capture network": "捕获网络",
      "Connection verified": "连通性已验证",
      "Action": "操作",
      "Check trust": "检查信任",
      "Choose where each agent uses CCR.": "选择每个 Agent 在哪里使用 CCR。",
      "Built-in": "内置",
      "Identifies the Claude Code user-agent to provide deep Claude Code integration.": "通过识别 Claude Code 的 user-agent，实现对 Claude Code 的深度适配。",
      "Identifies the Codex user-agent to provide deep Codex integration.": "通过识别 Codex 的 user-agent，实现对 Codex 的深度适配。",
      "Click Check Connection to verify connectivity with a real model request.": "点击检测连通性，用一次真实模型请求验证是否可用。",
      "Click Add to create one": "点击添加创建一项",
      "Click Install to add one": "点击安装添加一项",
      "Client": "客户端",
      "Client Analysis": "客户端分析",
      "Client Signals": "客户端信号",
      "Claude Code": "Claude Code",
      "CLI": "CLI",
      "APP": "APP",
      "CLI & APP": "CLI 和 APP",
      "CLI command": "CLI 命令",
      "Close": "关闭",
      "Close dialog": "关闭弹窗",
      "Code": "代码",
      "Codex": "Codex",
      "Codex model": "Codex 模型",
      "Grok CLI": "Grok CLI",
      "Grok model": "Grok 模型",
      "OpenCode": "OpenCode",
      "OpenCode model": "OpenCode 模型",
      "CLI only": "仅 CLI",
      "Concurrency": "并发",
      "Condition": "条件",
      "Conversation type": "会话类型",
      "Mode": "模式",
      "Match value": "匹配值",
      "Claude Design": "Claude Design",
      "Claude Design model": "Claude Design 模型",
      "Claude Design routes": "Claude Design 路由",
      "Configure": "配置",
      "Configure provider": "配置供应商",
      "Configure Extension": "配置扩展",
      "Configure extension": "配置扩展",
      "Configure plugin": "配置插件",
      "Configure plugin route": "配置插件路由",
      "Configure Routing": "配置路由",
      "Configure multiple provider API keys for this supplier.": "为这个供应商配置多个上游 API Key。",
      "Copy": "复制",
      "Create integration": "创建集成",
      "Credential": "凭据",
      "Credential chain": "凭据链",
      "Credential pool": "凭据池",
      "Credential saturated": "凭据已饱和",
      "Credentials JSON": "凭据 JSON",
      "Continue": "继续",
      "Custom config path": "自定义配置路径",
      "Core gateway": "核心网关",
      "Cost": "成本",
      "Estimated cost": "估算成本",
      "Connect agent": "接入 Agent",
      "Create a profile for your agent.": "为你的 Agent 创建配置档案。",
      "Cursor model": "Cursor 模型",
      "Cursor Proxy routes": "Cursor Proxy 路由",
      "Custom": "自定义",
      "Delete": "删除",
      "Delete bot": "删除 Bot",
      "Delete Extension": "删除扩展",
      "Delete Profile": "删除 Agent 配置",
      "Delete Provider": "删除供应商",
      "Delete Routing Rule": "删除路由规则",
      "Delete this bot?": "删除这个 Bot？",
      "Delete this extension from the configuration?": "从配置中删除这个扩展？",
      "Delete this agent profile from the configuration?": "从配置中删除这个 Agent 配置档案？",
      "Delete this provider from the configuration?": "从配置中删除这个供应商？",
      "Delete this routing rule from the configuration?": "从配置中删除这条路由规则？",
      "Dependencies": "依赖",
      "Default target model": "默认目标模型",
      "Default failure handling": "默认故障处理",
      "Default on failure": "默认失败处理",
      "Description": "描述",
      "CCR scanned this computer for Claude Code, Codex, Grok CLI, OpenCode CLI, and ZCode login states. Click Import to add one as a gateway provider.": "CCR 已扫描本机的 Claude Code、Codex、Grok CLI、OpenCode CLI 和 ZCode 登录态。点击导入即可添加为网关供应商。",
      "Detected": "已检测",
      "Detecting protocols": "正在探测协议",
      "Enter API endpoint, API key, and at least one model to enable connectivity check.": "填写 API 地址、API Key 和至少一个模型后，才可检测连通性。",
      "Import local agent login": "导入本机 Agent 登录态",
      "Import local agent provider": "导入本机 Agent 供应商",
      "ChatGPT login detected. Click Import to add it as a gateway provider.": "已检测到 ChatGPT 登录态。点击导入即可添加为网关供应商。",
      "Claude Code login detected. Click Import to add it as a gateway provider.": "已检测到 Claude Code 登录态。点击导入即可添加为网关供应商。",
      "Claude Code login was detected, but no usable access token was found.": "已检测到 Claude Code 登录态，但没有找到可用的 access token。",
      "Codex auth file was found, but no usable token was detected.": "已找到 Codex 认证文件，但没有检测到可用 token。",
      "Claude Code credential file was found, but no usable OAuth token was detected.": "已找到 Claude Code 凭据文件，但没有检测到可用 OAuth token。",
      "Grok CLI login detected. Click Import to add it as a gateway provider.": "已检测到 Grok CLI 登录态。点击导入即可添加为网关供应商。",
      "Grok CLI login was detected, but no usable access token was found.": "已检测到 Grok CLI 登录态，但没有找到可用的 access token。",
      "Grok CLI login was detected, but the access token is expired. Run grok login again, then rescan.": "已检测到 Grok CLI 登录态，但 access token 已过期。请重新运行 grok login，然后重新扫描。",
      "OpenCode CLI credential was found, but no usable API key was detected.": "已找到 OpenCode CLI 凭据，但没有检测到可用的 API key。",
      "OpenCode CLI login detected. Click Import to add it as a gateway provider.": "已检测到 OpenCode CLI 登录态。点击导入即可添加为网关供应商。",
      "OpenCode CLI public models detected. No login is required.": "已检测到 OpenCode CLI 公共模型，无需登录即可导入。",
      "CCR scanned this computer for local Claude Code, Codex, Grok CLI, OpenCode CLI, and ZCode providers. Click Import to add one as a gateway provider.": "CCR 已扫描本机的 Claude Code、Codex、Grok CLI、OpenCode CLI 和 ZCode 供应商。点击导入即可添加为网关供应商。",
      "Locked": "已加密",
      "Local agent login will be connected after saving this provider.": "保存这个供应商后会接入本机 Agent 登录态。",
      "Display name": "显示名称",
      "Double click to copy": "双击复制",
      "Edit": "编辑",
      "Edit bot": "编辑 Bot",
      "Edit API Key": "编辑 API 密钥",
      "Edit API key": "编辑 API 密钥",
      "Edit Profile": "编辑配置",
      "Edit Provider": "编辑供应商",
      "Edit provider": "编辑供应商",
      "Edit Routing Rule": "编辑路由规则",
      "Edit rule": "编辑规则",
      "Effect scope": "作用范围",
      "Enable": "启用",
      "Enabled": "启用",
      "Endpoint": "端点",
      "Entry mode": "入口模式",
      "Environment variables": "环境变量",
      "Endpoint Health": "端点健康",
      "Endpoint information": "端点信息",
      "HTTP status": "HTTP 状态码",
      "Expiration is required.": "过期时间不能为空。",
      "Let's start": "开始吧",
      "Error": "错误",
      "Error message": "错误信息",
      "Errors": "错误数",
      "Failed requests": "失败请求",
      "Failed to save profile before copying.": "复制前保存配置档案失败。",
      "Failed to save profile before opening.": "打开前保存配置档案失败。",
      "Expiration": "过期时间",
      "Expires at": "过期于",
      "Exact model": "精确模型",
      "Extensions": "扩展",
      "Fallback": "兜底",
      "Fallback chain": "回退链",
      "Fallback model": "回退模型",
      "Fallback target": "失败降级目标",
      "Fallback targets": "失败降级目标",
      "Failure handling": "故障处理",
      "Forward agent messages": "转发 Agent 消息",
      "Full content": "完整内容",
      "Full content unavailable": "无法读取完整内容",
      "Bot only forwards messages when opening the APP from CCR. CLI does not forward messages yet.": "Bot仅在使用CCR打开APP的情况下才会转发消息，cli目前不会转发消息",
      "Messages are forwarded only when using the corresponding app.": "仅在使用对应 App 时才会转发消息。",
      "First enabled": "首个启用规则",
      "Least utilized": "使用率最低",
      "Gateway conversation ID": "网关会话 ID",
      "Generated config": "生成配置",
      "Generated path": "生成路径",
      "Group": "群组",
      "Handoff": "接力",
      "Handoff target scan is available in the Electron app.": "接力目标扫描仅在 Electron App 中可用。",
      "Phone presence targets are experimental and do not affect runtime handoff yet. Handoff currently uses screen lock and idle time.": "手机在场目标仍为实验功能，当前不会参与运行时接力判断；接力目前使用锁屏与空闲时间。",
      "Headers": "请求头",
      "Header rows require keys.": "请求头行必须填写 Key。",
      "Fetch usage": "获取用量",
      "Fetch manifest": "拉取 manifest",
      "Hide advanced settings": "收起高级设置",
      "HTTP JSON request": "HTTP JSON 请求",
      "Host": "主机",
      "ID": "ID",
      "Import": "导入",
      "Import Provider": "导入供应商",
      "Import Provider Manifest": "导入供应商 Manifest",
      "Import JSON": "导入 JSON",
      "Imported provider": "已导入供应商",
      "Invalid JSON.": "JSON 无效。",
      "Image content": "图像内容",
      "Images": "图像",
      "Idle seconds": "空闲秒数",
      "Input": "输入",
      "Input tokens": "输入令牌",
      "Integration ID": "集成 ID",
      "Install": "安装",
      "Install and restart": "安装并重启",
      "App": "App",
      "Install Extension": "安装扩展",
      "Install extension": "安装扩展",
      "Install CA": "安装 CA",
      "Key": "键",
      "keys": "个 Key",
      "Keep Claude Code default": "保持 Claude Code 默认值",
      "Keep default": "保持默认值",
      "Keep embedded request model": "保留请求内模型",
      "Label": "标签",
      "Last apply": "上次应用",
      "Last checked": "上次检查",
      "Last request": "最近请求",
      "Last seen": "最近活跃",
      "Legacy profile table": "旧版配置档案表",
      "Limit": "限制",
      "Limits JSON": "限制 JSON",
      "Limits": "限制",
      "Loading": "加载中",
      "Local": "本地",
      "Logs": "日志",
      "Long context": "长上下文",
      "Long threshold": "长上下文阈值",
      "Max concurrency": "最大并发",
      "Max concurrent": "最大并发",
      "Manage bots used by agent profiles.": "管理 Agent 配置中可选择的 Bot。",
      "API key database": "API 密钥数据库",
      "Config database": "配置数据库",
      "Configuration is stored in SQLite. The legacy JSON file is only read once for migration.": "配置已存储在 SQLite 中，旧 JSON 文件只会在迁移时读取一次。",
      "Data export is only available in the Electron app.": "数据导出仅在 Electron 应用中可用。",
      "Export": "导出",
      "Export data": "导出数据",
      "Export current configuration and SQLite data into a single JSON backup file. The export contains API keys and should be stored securely.": "将当前配置和 SQLite 数据导出为单个 JSON 备份文件。导出内容包含 API 密钥，请妥善保存。",
      "Exported": "已导出",
      "Exporting": "正在导出",
      "Request log database": "请求日志数据库",
      "Method": "方法",
      "Model": "模型",
      "Model descriptions": "模型描述",
      "Model override": "模型覆盖",
      "Model routing": "模型路由",
      "Model prefix": "模型前缀",
      "Models": "模型",
      "Describe model strengths, tradeoffs, and best-fit tasks.": "描述模型优势、取舍和最适合的任务。",
      "Module path": "模块路径",
      "Name": "名称",
      "Networking": "网络",
      "Never": "永不",
      "No API keys": "暂无 API 密钥",
      "No agent activity": "暂无 Agent 行为数据",
      "No client signals": "暂无客户端信号",
      "No client usage yet": "暂无客户端用量",
      "No endpoint activity": "暂无端点活动",
      "No errors": "暂无错误",
      "No provider presets found": "没有匹配的预设供应商",
      "No provider usage yet": "暂无供应商用量",
      "No provider yet": "还没有供应商",
      "No requests captured yet": "暂无请求记录",
      "No bots configured": "尚未配置 Bot",
      "No data": "无数据",
      "No route activity": "暂无路由活动",
      "No targets found": "未发现目标",
      "No": "否",
      "None": "无",
      "Not configured": "未配置",
      "Not running": "未运行",
      "Agent profiles are disabled.": "Agent 配置档案已关闭。",
      "Open": "打开",
      "Open Agent": "打开Agent",
      "Open CA": "打开 CA",
      "Open Profile": "打开配置",
      "Only opened from CCR": "仅从 CCR 打开",
      "Open profiles": "查看配置档案",
      "Open providers": "查看供应商",
      "Output": "输出",
      "Output tokens": "输出令牌",
      "Observability": "可观测",
      "Off": "关闭",
      "On failure": "失败时",
      "Onboarding": "上手引导",
      "P50": "P50",
      "P95": "P95",
      "P99": "P99",
      "Parameters": "参数",
      "Path": "路径",
      "Platform": "平台",
      "Platform conversation ID": "平台会话 ID",
      "Phone Bluetooth target": "手机蓝牙目标",
      "Phone Wi-Fi target": "手机 Wi-Fi 目标",
      "Plugin": "插件",
      "Profile model unset": "未设置配置档案模型",
      "Enable a Claude Code profile before enabling this built-in route.": "请先启用一个 Claude Code 配置档案，再启用此内置路由。",
      "Enable a Codex profile before enabling this built-in route.": "请先启用一个 Codex 配置档案，再启用此内置路由。",
      "Set a model on the Claude Code profile before enabling this built-in route.": "请先为 Claude Code 配置档案设置模型，再启用此内置路由。",
      "Set a model on the Codex profile before enabling this built-in route.": "请先为 Codex 配置档案设置模型，再启用此内置路由。",
      "Plugin apps must be a JSON array.": "插件 App 必须是 JSON 数组。",
      "Plugin config JSON": "插件配置 JSON",
      "Plugin config must be a JSON object.": "插件配置必须是 JSON 对象。",
      "Local plugin selection is available in the Electron app.": "本地插件选择仅在 Electron App 中可用。",
      "Plugin route": "插件路由",
      "Plugin Settings": "插件设置",
      "Port": "端口",
      "Process": "进程",
      "Protocol": "协议",
      "Protocol details": "协议详情",
      "Protocol detection details": "协议检测详情",
      "Protocols detected": "协议已探测",
      "External core": "外部 Core",
      "External provider link": "外部供应商链接",
      "Provider": "供应商",
      "Provider Analysis": "供应商分析",
      "Provider credential JSON did not contain any API keys.": "供应商凭据 JSON 中没有可用 API Key。",
      "Provider credential JSON is invalid.": "供应商凭据 JSON 无效。",
      "Provider credential JSON must be an array or object.": "供应商凭据 JSON 必须是数组或对象。",
      "Provider credential limits JSON is invalid.": "供应商凭据限制 JSON 无效。",
      "Provider credential limits must be a JSON object.": "供应商凭据限制必须是 JSON 对象。",
      "Provider credential priority must be a positive number.": "供应商凭据优先级必须是正数。",
      "Provider credential rows require API keys.": "供应商凭据行必须填写 API Key。",
      "Provider credential rows require names.": "供应商凭据行必须填写名称。",
      "Provider credential weight must be a positive number.": "供应商凭据权重必须是正数。",
      "Provider ID": "供应商 ID",
      "Provider link failed": "供应商链接失败",
      "Provider middleware": "供应商中间件",
      "Provider name": "供应商名称",
      "Provider name and Base URL are required.": "供应商名称和基础 URL 不能为空。",
      "Provider name already exists.": "供应商名称已存在。",
      "Provider ready": "供应商已就绪",
      "Provider plugin": "供应商插件",
      "Provider website": "供应商网站",
      "Open provider website": "打开供应商网站",
      "Providers": "供应商",
      "Do not use proxy": "不使用代理",
      "Proxy": "代理",
      "Proxy mode": "代理模式",
      "Proxy server": "代理服务器",
      "Proxy source": "代理来源",
      "Use custom proxy": "使用自定义代理",
      "Use system proxy": "使用系统代理",
      "Preset provider": "预设供应商",
      "Profile": "配置",
      "Profile actions": "配置操作",
      "Profile name": "配置档案名称",
      "Profile name and required target settings are missing.": "请填写配置档案名称和必需的接入目标设置。",
      "Profile name, required target settings, and environment variable keys are required.": "请填写配置档案名称、必需的接入目标设置和环境变量 Key。",
      "Profile no longer exists.": "配置档案已不存在。",
      "Profile opening is only available in the Electron app.": "配置档案打开功能仅在 Electron App 中可用。",
      "Profile stopping is only available in the Electron app.": "配置档案停止功能仅在 Electron App 中可用。",
      "Profile ready": "配置档案已就绪",
      "Password": "密码",
      "Recent Errors": "最近错误",
      "Recent Requests": "最近请求",
      "Refresh": "刷新",
      "Refresh observability": "刷新可观测",
      "Refresh request logs": "刷新请求日志",
      "Refresh network captures": "刷新网络捕获",
      "Remove": "移除",
      "Remove API key": "移除 API 密钥",
      "Remove extension": "移除扩展",
      "Remove limit": "移除限制",
      "Remove provider": "移除供应商",
      "Remove profile": "移除配置档案",
      "Remove rule": "移除规则",
      "Replace existing provider": "替换已有供应商",
      "Request": "请求",
      "Request action": "请求动作",
      "Request ID": "请求 ID",
      "Request logs database": "请求日志数据库",
      "Request timeout ms": "请求超时 ms",
      "Requests": "请求",
      "Rewrite request parameters": "改写请求参数",
      "Set": "设置",
      "Append to array": "追加到数组",
      "Prepend to array": "插入到数组开头",
      "Remove from array": "从数组移除",
      "Replace in array": "替换数组元素",
      "starts with": "开头匹配",
      "contains": "包含",
      "contains deep": "深度包含",
      "not contains": "不包含",
      "Attempt": "尝试",
      "Final attempt": "最终尝试",
      "Next retry wait": "下次重试等待",
      "Retries": "重试次数",
      "Retry": "继续重试",
      "Retry attempts": "重试尝试",
      "Weighted order": "按权重排序",
      "Ready to route": "可以开始路由",
      "Restart proxy": "重启代理",
      "Route": "路由",
      "Route graph": "路由链路图",
      "Route hops": "路由节点",
      "Route node": "路由节点",
      "Route trace": "路由轨迹",
      "Route Observability": "路由可观测",
      "View route graph": "查看路由链路图",
      "Hover a node to inspect routing operations": "将鼠标悬停在节点上查看路由操作",
      "Hover over a route node to inspect its operations.": "将鼠标悬停在路由节点上查看操作详情。",
      "Routing operations": "路由操作",
      "No request fields changed": "没有请求字段变更",
      "Not recorded": "未记录",
      "Not present": "不存在",
      "This hop was truncated": "此路由节点已截断",
      "Decision": "决策",
      "Complete": "完整",
      "Partial": "部分",
      "hops": "个节点",
      "attempts": "次尝试",
      "ingress": "接入",
      "compatibility": "兼容处理",
      "routing": "路由",
      "capability": "能力匹配",
      "enrichment": "请求增强",
      "planning": "回退规划",
      "attempt": "调用尝试",
      "core": "核心网关",
      "outcome": "结果",
      "error": "错误",
      "noop": "无变更",
      "Receive request": "接收请求",
      "Rewrite gateway headers": "重写网关请求头",
      "Read model from request path": "从请求路径读取模型",
      "Select target model": "选择目标模型",
      "Enrich Claude Code request": "增强 Claude Code 请求",
      "Enrich agent request": "增强 Agent 请求",
      "Apply request rewrite": "应用请求改写",
      "Apply selected model": "写入目标模型",
      "Write routing result": "写入路由结果",
      "Match provider capabilities": "匹配供应商能力",
      "Remove content-length header": "移除 Content-Length 请求头",
      "Build model fallback chain": "生成模型回退链",
      "Build upstream request": "构建上游请求",
      "Record upstream result": "记录上游调用结果",
      "Convert Cursor request": "转换 Cursor 请求",
      "Convert apply_patch calls": "转换 apply_patch 调用",
      "Resolve Claude Code model": "解析 Claude Code 模型",
      "Resolve Claude App model": "解析 Claude App 模型",
      "Inject web search results": "注入网页搜索结果",
      "Inject web search continuation": "注入网页搜索续接上下文",
      "Call custom router": "调用自定义路由",
      "add": "新增",
      "replace": "替换",
      "remove": "移除",
      "Rules": "规则",
      "Save": "保存",
      "Screen lock": "锁屏",
      "Search API keys": "搜索 API 密钥",
      "Search extensions": "搜索扩展",
      "Search models": "搜索模型",
      "Search network captures": "搜索网络捕获",
      "Search providers": "搜索供应商",
      "Search providers or models": "搜索供应商或模型",
      "Search request logs": "搜索请求日志",
      "Search routing rules": "搜索路由规则",
      "Select account": "选择账户",
      "Select bot": "选择 Bot",
      "Select data": "选择数据",
      "Server": "服务",
      "Startup timeout ms": "启动超时 ms",
      "State directory": "状态目录",
      "Account component": "账户组件",
      "All accounts": "所有账户",
      "All credentials": "全部凭据",
      "Last updated": "上次更新",
      "Refresh account": "刷新账户",
      "Refreshing account": "正在刷新账户",
      "Add widget": "添加组件",
      "Analysis component": "分析组件",
      "Arc": "弧形",
      "Area": "面积图",
      "Average latency": "平均延迟",
      "Bar": "柱状图",
      "Bars": "横条",
      "Breakdown component": "构成组件",
      "Card": "卡片",
      "Cards": "卡片",
      "Change widget type": "切换组件类型",
      "Client or provider": "客户端或供应商",
      "Component properties": "组件属性",
      "Components": "组件",
      "Component category": "组件类型",
      "Compact": "紧凑",
      "Composed": "组合图",
      "Data": "数据",
      "Done": "完成",
      "Donut": "环形图",
      "Edit widgets": "编辑组件",
      "Activity": "活跃度",
      "Activity component": "活跃度组件",
      "Avg / day": "日均",
      "Avg / week": "周均",
      "F": "五",
      "Full": "整行",
      "Header component": "标题组件",
      "Heatmap": "热力图",
      "Large": "大",
      "Less": "少",
      "Line": "折线图",
      "Longest streak": "最长连续",
      "M": "一",
      "Medium": "中",
      "Metric": "指标",
      "Metric component": "指标组件",
      "Model Distribution": "模型分布",
      "Model distribution": "模型分布",
      "Nested rings": "内外圆",
      "No widget selected": "未选择组件",
      "No widgets configured": "未配置组件",
      "Overview layout": "概览布局",
      "Overview": "概览",
      "Other": "其他",
      "Pie": "饼图",
      "Provider component": "供应商组件",
      "Remove widget": "移除组件",
      "Preview": "预览",
      "Requests, tokens, cost": "请求、Token、成本",
      "Result": "结果",
      "Reset layout": "重置布局",
      "Close fullscreen JSON viewer": "关闭全屏 JSON 查看器",
      "Fullscreen JSON viewer": "全屏 JSON 查看器",
      "Open fullscreen JSON viewer": "全屏查看 JSON",
      "Resize column width": "调整列宽",
      "Resize widget height": "调整组件高度",
      "Resize widget size": "调整组件大小",
      "Resize widget width": "调整组件宽度",
      "Ring": "圆环",
      "Semicircle": "半圆",
      "Small": "小",
      "Stacked": "堆叠",
      "Status component": "状态组件",
      "Status timeline": "状态时间线",
      "Style": "样式",
      "Table": "表格",
      "Timeline": "时间线",
      "Token activity": "Token 活跃度",
      "Token activity heatmap": "Token 活跃度热力图",
      "Token distribution": "Token 分布",
      "Token or model distribution": "Token 或模型分布",
      "Token mix, rings, model share": "Token 构成、环形指标、模型占比",
      "Token mix component": "Token 构成组件",
      "Trend component": "趋势组件",
      "Usage over time": "按时间查看用量",
      "Weight": "权重",
      "Widget": "组件",
      "Widget size": "组件大小",
      "Wide": "宽",
      "Share cards": "分享卡片",
      "Share card": "分享卡片",
      "Save social-ready cards as PNG images": "将适合社交媒体发布的卡片保存为 PNG 图片",
      "Social media PNG cards": "适合社交媒体发布的 PNG 卡片",
      "PNG export": "PNG 导出",
      "Save image": "保存图片",
      "Saving": "正在保存",
      "Export failed": "导出失败",
      "AI Usage Wrapped": "AI 用量年报",
      "CCR Route Map": "CCR 路由图",
      "Model Leaderboard": "模型排行榜",
      "AI Fuel Cockpit": "AI 燃料仪表",
      "Token Calendar Poster": "Token 日历海报",
      "Spend Receipt": "消费小票",
      "tokens routed through CCR": "通过 CCR 路由的令牌",
      "Top model": "最高频模型",
      "Top provider": "最高频供应商",
      "No provider activity": "暂无供应商活动",
      "Peak day": "峰值日期",
      "Generated by CCR": "由 CCR 生成",
      "Range": "范围",
      "W": "三",
      "Yes": "是",
      "Set as default provider": "设为默认供应商",
      "Show credential settings": "显示凭据配置",
      "Show full content": "查看完整内容",
      "Session": "会话",
      "Session Detail": "会话详情",
      "Session Requests": "会话请求",
      "Sessions": "会话",
      "Clear session": "清除会话",
      "Loading session metrics": "正在加载会话指标",
      "Trace Detail": "链路详情",
      "Trace duration": "链路耗时",
      "Trace runs": "链路节点",
      "Call chain": "调用链路",
      "Runs": "节点",
      "Run": "节点",
      "LLM": "LLM",
      "LLM calls": "LLM 调用",
      "No trace runs": "暂无链路节点",
      "No model activity": "暂无模型活动",
      "No session requests": "暂无会话请求",
      "Show all sessions": "显示所有会话",
      "Status": "状态",
      "Status codes": "状态码",
      "Stream": "流式",
      "Streaming": "流式",
      "Non-streaming": "非流式",
      "Started": "开始时间",
      "Source truncated": "源数据已截断",
      "Details": "详情",
      "Subagent": "子代理",
      "Subagent Routing": "Subagent 路由",
      "Subagent calls": "Subagent 调用",
      "Subagents": "Subagent",
      "Success": "成功",
      "Success rate": "成功率",
      "System proxy": "系统代理",
      "System default": "系统默认",
      "Target": "目标",
      "Tenant ID": "租户 ID",
      "Target model": "目标模型",
      "Target model is required.": "目标模型不能为空。",
      "Thread": "线程",
      "Thread ID": "线程 ID",
      "Thinking": "思考",
      "Token Mix": "令牌构成",
      "Total": "总计",
      "Total tokens": "总令牌",
      "Username": "用户名",
      "Today": "今天",
      "Token threshold": "令牌阈值",
      "Truncated": "已截断",
      "Tokens": "令牌",
      "tokens": "令牌",
      "day": "天",
      "days": "天",
      "Tool": "工具",
      "Tool Usage": "工具使用",
      "Tool calls": "工具调用",
      "Tools": "工具",
      "Top tools": "高频工具",
      "Routes": "路由",
      "Timeout": "超时",
      "Type": "类型",
      "UA": "UA",
      "Unset": "未设置",
      "URL": "URL",
      "URL is required.": "URL 不能为空。",
      "Usage mode": "用量模式",
      "Usage request URL": "用量请求 URL",
      "Usage request URL is required.": "用量请求 URL 不能为空。",
      "Usage request URL must use http or https.": "用量请求 URL 必须使用 http 或 https。",
      "Usage database": "用量数据库",
      "Usage Trend": "用量趋势",
      "User idle": "用户空闲",
      "Insert example": "插入示例",
      "Insert New API user balance": "插入 New API 用户余额",
      "New API user ID": "New API 用户 ID",
      "Virtual model": "Fusion",
      "Virtual Models": "Fusion",
      "Add MCP Server": "添加 MCP 服务",
      "Add MCP server": "添加 MCP 服务",
      "Add Virtual Model": "添加 Fusion",
      "Add virtual model": "添加 Fusion",
      "Append instructions": "追加指令",
      "At least one match alias, prefix, or suffix is required.": "至少需要一个匹配别名、前缀或后缀。",
      "Allow client tools": "允许客户端工具",
      "Base model": "基础模型",
      "Base model mode": "基础模型模式",
      "Client tools": "客户端工具",
      "Client-visible": "客户端可见",
      "Clients": "客户端",
      "Command": "命令",
      "Command is required.": "命令不能为空。",
      "Decorate only": "仅装饰",
      "Decorate only mode cannot use internal tools.": "仅装饰模式不能使用内部工具。",
      "Description template": "描述模板",
      "Display name template": "显示名称模板",
      "Edit MCP Server": "编辑 MCP 服务",
      "Edit MCP server": "编辑 MCP 服务",
      "Edit Virtual Model": "编辑 Fusion",
      "Edit virtual model": "编辑 Fusion",
      "Exact aliases": "精确别名",
      "Exact aliases require a fixed model or original request model.": "精确别名需要固定模型或原始请求模型。",
      "Execution mode": "执行模式",
      "Expose in models": "暴露到模型列表",
      "Fixed base model": "固定基础模型",
      "Fixed base model is required.": "必须选择固定基础模型。",
      "Fixed model": "固定模型",
      "Injected tool names": "注入工具名",
      "Injected tools": "注入工具",
      "Input schema JSON": "输入 schema JSON",
      "Internal": "内部",
      "Invalid input schema JSON for": "输入 schema JSON 无效：",
      "Invalid tool choice JSON.": "Tool choice JSON 无效。",
      "Key is required.": "Key 不能为空。",
      "Materialize": "物化",
      "MCP servers": "MCP 服务",
      "MCP tools": "MCP 工具",
      "Match": "匹配",
      "Match type": "匹配方式",
      "Match multimodal": "匹配多模态",
      "Match web search": "匹配网页搜索",
      "Max tool calls": "最大工具调用",
      "Max tool calls must be greater than zero.": "最大工具调用必须大于 0。",
      "Max turns": "最大轮次",
      "Max turns must be greater than zero.": "最大轮次必须大于 0。",
      "Fusion combines a model with another model or tools into a new model.": "将模型和模型/工具组合起来成为一个新的模型。",
      "Fusion example": "例如：GLM 5.2 + GLM 5V Turbo = GLM 5.2V",
      "Vision tool configuration": "视觉工具配置",
      "Choose a configured gateway model for image understanding.": "选择已配置的网关模型作为图片理解模型。",
      "Vision model": "视觉模型",
      "Vision model is required.": "必须选择视觉模型。",
      "Web search configuration": "Web Search 配置",
      "Search provider": "搜索类型",
      "In-app Browser": "内置浏览器",
      "Provider configuration": "类型配置",
      "Search engine": "搜索引擎",
      "Safe search": "安全搜索",
      "Language": "语言",
      "Bot language": "Bot 语言",
      "Maximum turn time (minutes)": "单次运行最长时间（分钟）",
      "Session idle reset (minutes, 0 disables)": "会话空闲重置（分钟，0 为关闭）",
      "Long message chunk size": "长消息分片字符数",
      "Maximum attachment size (MB)": "附件大小上限（MB）",
      "Stream replies and progress": "流式回复与进度",
      "Send and receive attachments": "收发附件",
      "Allow Agent shell tools": "允许 Agent 使用 Shell 工具",
      "Controls Agent tool permission; it does not add a Bot shell command.": "仅控制 Agent 工具权限，不会增加 Bot Shell 命令。",
      "Local App": "本机 App",
      "Starting": "正在连接",
      "Bot activity": "Bot 动态",
      "Last event": "最后事件",
      "Waiting for messages": "等待消息",
      "pending": "待发送",
      "Country": "国家/地区",
      "Advanced variables": "高级变量",
      "Default": "默认",
      "Moderate": "中等",
      "Strict": "严格",
	      "Add tool": "添加工具",
	      "Add variable": "添加变量",
	      "Add custom MCP": "添加自定义 MCP",
	      "Add custom MCP tool": "添加自定义 MCP 工具",
	      "Custom MCP tool": "自定义 MCP 工具",
	      "Discover tools": "发现工具",
      "Import MCP JSON": "导入 MCP JSON",
      "MCP JSON": "MCP JSON",
	      "MCP server": "MCP 服务",
      "MCP server name already exists.": "MCP 服务名称已存在。",
      "Arguments": "参数",
      "Working directory": "工作目录",
      "API key env": "API Key 环境变量",
      "CLAUDE_APP_PATH": "CLAUDE_APP_PATH",
      "CHATGPT_APP_PATH": "CHATGPT_APP_PATH",
      "OPENCODE_APP_PATH": "OPENCODE_APP_PATH",
      "Drop the app here or paste the executable path": "拖动应用到这里，或粘贴可执行文件路径",
	      "Third-party tool environment": "三方工具环境变量",
	      "Environment variable keys are required when values are set.": "设置变量值时必须填写变量名。",
	      "MCP tool discovery is available in the Electron app.": "MCP 工具发现仅在 Electron App 中可用。",
      "No MCP servers found in JSON.": "JSON 中未找到 MCP 服务。",
	      "Image recognition": "图片识别",
      "Image recognition and Web Search": "图片识别和 Web Search",
      "Generic image understanding tool for OCR, screenshot analysis, chart reading, UI comparison, error diagnosis, and other multi-image tasks.": "通用图片理解工具，支持 OCR、截图分析、图表解读、UI 对比、错误诊断等多图任务。",
      "Generic web search tool supporting Brave, Bing, Google CSE, Serper, SerpAPI, Tavily, and Exa.": "通用网络搜索工具，支持 Brave、Bing、Google CSE、Serper、SerpAPI、Tavily、Exa。",
      "Generic web search tool supporting hidden in-app browser search plus Brave, Bing, Google CSE, Serper, SerpAPI, Tavily, and Exa.": "通用网络搜索工具，支持隐藏内置浏览器搜索，以及 Brave、Bing、Google CSE、Serper、SerpAPI、Tavily、Exa。",
      "Web Search": "网页搜索",
      "New model": "新模型",
      "New model is required.": "新模型不能为空。",
      "Base model is required.": "基础模型不能为空。",
      "Tool is required.": "必须选择工具。",
	      "No matching virtual models": "没有匹配的 Fusion",
	      "No MCP servers configured": "未配置 MCP 服务",
	      "No tools discovered": "未发现工具",
	      "No tools available": "无可选工具",
	      "No tools configured": "未配置工具",
	      "No virtual models configured": "尚未配置 Fusion",
      "Original request model": "原始请求模型",
      "Adapt image requests": "适配图像请求",
      "Adapt web search": "适配网页搜索",
      "Prefixes": "前缀",
      "Prefix": "前缀",
      "Prefix is required.": "前缀不能为空。",
      "Prepend instructions": "前置指令",
      "Protocol version": "协议版本",
      "Remove MCP server": "移除 MCP 服务",
      "Remove tool": "移除工具",
      "Remove model": "移除模型",
      "Remove virtual model": "移除 Fusion",
      "Replace instructions": "替换指令",
      "Request timeout": "请求超时",
      "Request timeout must be at least 100 ms.": "请求超时至少为 100 ms。",
	      "Search virtual models": "搜索 Fusion",
	      "Select tool": "选择工具",
	      "Startup timeout": "启动超时",
      "Startup timeout must be at least 100 ms.": "启动超时至少为 100 ms。",
      "Stdio message mode": "Stdio 消息模式",
      "Strip alias prefix": "移除别名前缀",
      "Strip alias suffix": "移除别名后缀",
      "Suffixes": "后缀",
      "Suffix": "后缀",
      "Suffix is required.": "后缀不能为空。",
	      "Tool choice": "Tool choice",
	      "Tool discovery failed": "工具发现失败",
	      "Tool loop": "工具循环",
      "Tool name": "工具名称",
      "Tool name is required.": "工具名称不能为空。",
      "Tool names must be unique.": "工具名称不能重复。",
      "Transport": "传输",
      "Unavailable": "不可用",
      "Visibility": "可见性",
      "WebSocket URL": "WebSocket URL",
      "WebSocket URL is required.": "WebSocket URL 不能为空。",
      "Env must use KEY=VALUE lines or a JSON object.": "Env 必须使用 KEY=VALUE 行或 JSON object。",
      "Env rows require keys.": "环境变量行必须填写 Key。",
      "Headers must use KEY=VALUE lines or a JSON object.": "Headers 必须使用 KEY=VALUE 行或 JSON object。",
      "Value": "值",
      "Web search": "网页搜索",
      "Browser apps JSON": "浏览器 App JSON",
      "Account": "账户",
      "Account Balance": "账户余额",
      "Account balance connectors": "账户余额连接器",
      "Add at least one account connector or disable account balance.": "请至少添加一个账户连接器，或关闭账户余额。",
      "Balance": "余额",
      "Balance field": "余额字段",
      "Balance remaining field": "余额剩余字段",
      "Balance rem": "余额剩余",
      "Balance total": "余额总额",
      "Balance total field": "余额总额字段",
      "Balance unit": "余额单位",
      "Balance used": "余额已用",
      "Balance used field": "余额已用字段",
      "Body": "请求体",
      "Cash balance": "现金余额",
      "Charge balance": "充值余额",
      "Connectors JSON": "连接器 JSON",
      "Copy provider plugin link": "复制供应商插件链接",
      "Credit balance": "信用余额",
      "CCR will fetch this HTTPS manifest with strict safety checks before showing provider details.": "CCR 会在严格安全检查后拉取这个 HTTPS manifest，再展示供应商详情。",
      "Current balance": "当前余额",
      "Each plugin app requires name and url.": "每个插件 App 都需要 name 和 url。",
      "Wrapper": "包装服务",
      "Wrapper runtime": "包装运行时",
      "Wrapper plugin": "包装插件",
      "5h quota": "5 小时额度",
      "Granted balance": "赠送余额",
      "Individual limit": "个人额度",
      "Lifetime tokens": "累计令牌",
      "Manual resets": "主动重置次数",
      "Monthly budget": "月度预算",
      "Peak daily tokens": "日峰值令牌",
      "Primary quota": "主额度",
      "Secondary quota": "副额度",
      "Topped-up balance": "充值余额",
      "Total credits": "总额度",
      "Total usage": "总用量",
      "Voucher balance": "代金券余额",
      "Weekly quota": "周额度",
      "expired": "已过期",
      "expires in": "剩余",
      "resets": "次",
      "All": "全部",
      "API endpoint": "API 地址",
      "Active": "生效中",
      "Available": "可用",
      "CA certificate": "CA 证书",
      "Capability": "能力",
      "Checking CA certificate...": "正在检查 CA 证书...",
      "Check Trust": "检查信任",
      "Choose folder": "选择目录",
      "Clear": "清除",
      "Clear network captures": "清除网络捕获",
      "Collapse": "收起",
      "Collapse models": "收起模型",
      "Copied": "已复制",
      "Copied API key": "已复制 API 密钥",
      "Copy API key": "复制 API 密钥",
      "Custom models": "自定义模型",
      "Press Enter to add": "按下回车进行添加",
      "Detected automatically": "已自动检测",
      "Detected compatibility": "检测到的兼容方式",
      "Detected endpoint": "检测到的地址",
      "Detecting icon": "正在检测图标",
      "Detecting provider": "正在检测供应商",
      "Disabled": "已禁用",
      "Docs": "文档",
      "Edit description": "编辑描述",
      "Effective": "生效",
      "Expand": "展开",
      "Expand models": "展开模型",
      "Expired": "已过期",
      "Expires": "过期",
      "Filter": "筛选",
      "Filter agent": "筛选 Agent",
      "Filter request log model": "筛选请求日志模型",
      "Filter request log provider": "筛选请求日志供应商",
      "Filter request log status": "筛选请求日志状态",
      "Full reset": "完整重置",
      "Daily": "每天",
      "Monthly": "每月",
      "Weekly": "每周",
      "Yearly": "每年",
      "hour": "小时",
      "hr": "小时",
      "min": "分钟",
      "minute": "分钟",
      "month": "个月",
      "week": "周",
      "Invalid": "无效",
      "Manual install": "手动安装",
      "Manual install command": "手动安装命令",
      "Manifest URL": "Manifest URL",
      "Marketplace": "市场",
      "Model name": "模型名称",
      "Models are required. Ask the provider to include models=... in the link.": "需要模型列表。请让供应商在链接中加入 models=...。",
      "Models will be detected automatically.": "模型会自动探测。",
      "More": "更多",
      "Provider models": "供应商模型",
      "Runtime provider": "运行时供应商",
      "Used in Agent routing prompts": "用于 Agent 路由提示词",
      "Read only": "只读",
      "Search all models": "搜索全部模型",
      "Source": "来源",
      "Virtual": "Fusion",
      "Virtual models": "Fusion",
      "No models available": "暂无可用模型",
      "No supported account usage endpoint is available for this provider. Configure an HTTP JSON connector or disable account balance.": "该供应商暂无可用的账户用量端点。请配置 HTTP JSON 连接器，或关闭账户余额读取。",
      "Direct": "直连",
      "Drag cards to arrange": "拖动卡片排序",
      "Drag to move": "拖动排序",
      "Move": "移动",
      "Move down": "下移",
      "Move up": "上移",
      "Network capture is paused": "网络捕获已暂停",
      "No API keys configured": "未配置 API 密钥",
      "Available models": "可用模型",
      "No body": "无正文",
      "No extensions installed": "未安装扩展",
      "No limits configured": "未配置限制",
      "No matching API keys": "没有匹配的 API 密钥",
      "No matching captures": "没有匹配的捕获",
      "No matching extensions": "没有匹配的扩展",
      "No matching models": "没有匹配的模型",
      "No matching providers": "没有匹配的供应商",
      "No matching routing rules": "没有匹配的路由规则",
      "No account balance connectors configured": "未配置账户余额连接器",
      "No available models": "没有可用模型",
      "No protocol detection yet": "尚未检测协议",
      "No response fields": "没有响应字段",
      "No unavailable models": "没有不可用模型",
      "Name is required.": "名称不能为空。",
      "No usage data available.": "暂无可用量数据。",
      "OpenAI Chat": "OpenAI Chat",
      "OpenAI Responses": "OpenAI Responses",
      "Anthropic Messages": "Anthropic Messages",
      "Gemini Generate": "Gemini 生成",
      "Gemini Interactions": "Gemini Interactions",
      "Model required before protocol verification.": "需要先填写模型，才能验证协议。",
      "No endpoint candidates available.": "没有可用的端点候选。",
      "Request failed.": "请求失败。",
      "Select or enter at least one model.": "请选择或输入至少一个模型。",
      "Enter at least one model.": "请输入至少一个模型。",
      "Generated output is limited to 1 token for connectivity checks.": "连通性检测会把生成输出限制为 1 个 token。",
      "Check results": "检测结果",
      "Models to check": "要检测的模型",
      "Raw connector JSON": "原始连接器 JSON",
      "Remote provider manifest": "远程供应商 Manifest",
      "Refresh interval ms": "刷新间隔（毫秒）",
      "Response fields": "响应字段",
      "Manual reset credit": "主动重置次数",
      "Reset": "重置",
      "Reset complete": "重置完成",
      "Reset is unavailable.": "重置不可用。",
      "Reset manual credit": "重置主动次数",
      "Resetting": "正在重置",
      "Usage reset": "用量重置",
      "Used": "已使用",
      "Select at least one protocol.": "请至少选择一个协议。",
      "Select at least one usage response field.": "请至少选择一个用量响应字段。",
      "Showing first response fields only.": "仅显示前面的响应字段。",
      "Standard usage endpoint": "标准用量端点",
      "Standard usage endpoint will try provider-hosted CCR account endpoints.": "标准用量端点会尝试供应商托管的 CCR 账户端点。",
      "Sub limit": "订阅上限",
      "Sub rem": "订阅剩余",
      "Start check": "开始检测",
      "Subscription limit field": "订阅上限字段",
      "Subscription remaining field": "订阅剩余字段",
      "Subscription reset field": "订阅重置字段",
      "Subscription unit": "订阅单位",
      "Status field": "状态字段",
      "Message field": "消息字段",
      "Supports standard, http-json, plugin, and local-estimate connectors.": "支持 standard、http-json、plugin 和 local-estimate 连接器。",
      "Switch to HTTP JSON request to configure method, URL, headers, body, and response fields.": "切换到 HTTP JSON 请求即可配置 method、URL、header、body 和响应字段。",
      "Test usage request": "测试用量请求",
      "This check sends real model requests with your provider API key and may consume account balance.": "本次检测会使用你的供应商 API Key 发起真实模型请求，可能消耗账户余额。",
      "Unavailable models": "不可用模型",
      "No marketplace extensions": "市场暂无扩展",
      "No fallback models configured": "未配置回退模型",
      "No fallback targets configured": "未配置失败降级目标",
      "No models configured": "未配置模型",
      "No local login state was found for this agent.": "未找到这个 Agent 的本机登录态。",
      "No provider credentials configured": "未配置供应商凭据",
      "No request rewrite": "不改写请求",
      "Not found": "未找到",
      "Other / custom API endpoint": "其他 / 自定义 API 地址",
      "Pending": "等待中",
      "Priority": "优先级",
      "Priority only": "仅按优先级",
      "Priority spillover": "优先级溢出",
      "Ready": "可导入",
      "Scanning local agent logins": "正在扫描本机 Agent 登录态",
      "Select preset provider": "选择 预设供应商",
      "ZCode login detected. Click Import to add it as a gateway provider.": "已检测到 ZCode 登录态。点击导入即可添加为网关供应商。",
      "ZCode login was detected, but its local credential is encrypted and cannot be imported automatically.": "已检测到 ZCode 登录态，但本机凭据已加密，无法自动导入。",
      "ZCode login was detected, but no usable provider API key was found in ZCode config.": "已检测到 ZCode 登录态，但 ZCode 配置中没有找到可用的供应商 API key。",
      "ZCode provider API key detected in local ZCode config. Click Import to add it as a gateway provider.": "已在本机 ZCode 配置中检测到供应商 API key。点击导入即可添加为网关供应商。",
      "Kimi API (China)": "Kimi API（国内）",
      "Kimi API (Global)": "Kimi API（海外）",
      "Kimi Code - Coding Plan": "Kimi Code - Coding Plan",
      "Zhipu AI (China)": "智谱 AI (国内)",
      "Zhipu AI (China) - Coding Plan": "智谱 AI (国内) - Coding Plan",
      "Zhipu AI (China) - General Endpoint": "智谱 AI (国内) - 通用端点",
      "Z.ai (Global)": "Z.ai (国外)",
      "Z.ai (Global) - Coding Plan": "Z.ai (国外) - Coding Plan",
      "Z.ai (Global) - General Endpoint": "Z.ai (国外) - 通用端点",
      "After you enter the API endpoint and key, the system will automatically detect supported protocols and available models.": "填写 API 地址和密钥后，系统会自动探测支持的协议和可用模型。",
      "Enter a model manually if automatic detection does not return a model list.": "如果自动检测没有返回模型列表，可以手动输入模型名称。",
      "No network captures": "暂无网络捕获",
      "No plugin routes configured": "未配置插件路由",
      "No profiles for this agent": "当前 Agent 未配置档案",
      "No profiles configured": "尚未配置档案",
      "No providers configured": "未配置供应商",
      "No query parameters": "无查询参数",
      "No request headers": "无请求头",
      "Next step": "下一步",
      "No response headers": "无响应头",
      "No recent agent requests": "暂无最近 Agent 请求",
      "No session activity": "暂无会话活动",
      "No subagent calls": "暂无 Subagent 调用",
      "No tool calls": "暂无工具调用",
      "No routing rules configured": "未配置路由规则",
      "No updates available": "当前已是最新版本",
      "Not installed": "未安装",
      "Not set": "未设置",
      "Pause capture": "暂停捕获",
      "Pause network capture": "暂停网络捕获",
      "Pause service": "暂停服务",
      "Previous page": "上一页",
      "Previous step": "上一步",
      "Proxy not running": "代理未运行",
      "Proxy status": "代理状态",
      "Proxy CA certificate is trusted.": "Proxy CA 证书已信任。",
      "Proxy CA certificate is not trusted.": "Proxy CA 证书未被信任。",
      "Proxy CA certificate is not trusted:": "Proxy CA 证书未被信任：",
      "Proxy CA certificate is not installed. Install the CA certificate before enabling proxy mode.": "Proxy CA 证书尚未安装。启用代理模式前请先安装 CA 证书。",
      "Proxy CA certificate and private key do not match. Recreate the proxy CA certificate, trust the new CA, then restart proxy mode.": "Proxy CA 证书和私钥不匹配。请重新创建 Proxy CA 证书，信任新的 CA，然后重启代理模式。",
      "Proxy CA certificate is installed in the macOS System keychain.": "Proxy CA 证书已安装到 macOS 系统钥匙串。",
      "Proxy CA certificate is installed only in the login keychain. Install it into the macOS System keychain so Chrome can trust HTTPS proxy certificates.": "Proxy CA 证书只安装在登录钥匙串中。请安装到 macOS 系统钥匙串，Chrome 才能信任 HTTPS 代理证书。",
      "Proxy CA certificate is not installed in the macOS System keychain. Install and trust this exact CA certificate before enabling HTTPS proxying.": "Proxy CA 证书尚未安装到 macOS 系统钥匙串。启用 HTTPS 代理前，请安装并信任这份 CA 证书。",
      "Proxy CA certificate could not be read. Reinstall the CA certificate.": "无法读取 Proxy CA 证书。请重新安装 CA 证书。",
      "Proxy CA certificate is trusted by the system trust store.": "Proxy CA 证书已被系统信任存储信任。",
      "Certificate detection is available in the Electron app.": "证书检测仅在 Electron App 中可用。",
      "Certificate install is available in the Electron app.": "证书安装仅在 Electron App 中可用。",
      "Proxy certificate detection is available in the Electron app.": "代理证书检测仅在 Electron App 中可用。",
      "Install and trust the proxy CA certificate before enabling proxy mode.": "启用代理模式前，请先安装并信任 Proxy CA 证书。",
      "Certificate installed and trusted. Proxy mode enabled.": "证书已安装并信任，代理模式已启用。",
      "Certificate installed into the macOS System keychain.": "证书已安装到 macOS 系统钥匙串。",
      "Certificate installed into the current user's Root store.": "证书已安装到当前用户的根证书存储。",
      "Automatic certificate install is not supported on this platform. Import the CA file into the system trust store manually.": "当前平台不支持自动安装证书。请手动将 CA 文件导入系统信任存储。",
      "Certificate installation was cancelled. Install the CA into the macOS System keychain to use HTTPS proxying.": "证书安装已取消。要使用 HTTPS 代理，请将 CA 安装到 macOS 系统钥匙串。",
      "macOS did not allow CCR to request administrator authorization:": "macOS 未允许 CCR 请求管理员授权：",
      "Opened Terminal installer:": "已打开终端安装器：",
      "Could not open Terminal installer:": "无法打开终端安装器：",
      "Click Install CA and approve the administrator prompt to install it into the System keychain.": "点击“安装 CA”，并在管理员提示中批准安装到系统钥匙串。",
      "If trust is still not detected, open Keychain Access > System and find the CCR MITM Proxy certificate.": "如果仍未检测到信任，请打开“钥匙串访问”>“系统”，找到 CCR MITM Proxy 证书。",
      "Open Trust, set When using this certificate to Always Trust, then restart the browser or client.": "展开“信任”，将“使用此证书时”设为“始终信任”，然后重启浏览器或客户端。",
      "Return here and click Check Trust.": "返回这里并点击“检查信任”。",
      "Click Install CA, or open the CA file and import it manually.": "点击“安装 CA”，或打开 CA 文件并手动导入。",
      "Place it under Current User > Trusted Root Certification Authorities > Certificates.": "将它放到“当前用户”>“受信任的根证书颁发机构”>“证书”下。",
      "Restart the browser or client.": "重启浏览器或客户端。",
      "Open the CA file and import it into your OS or browser trust store.": "打开 CA 文件，并将它导入操作系统或浏览器的信任存储。",
      "For Firefox, Java, Python, Node, or other clients with a private CA store, import the CA there as well.": "对于 Firefox、Java、Python、Node 或其他使用独立 CA 存储的客户端，也需要在那里导入这份 CA。",
      "Resume capture": "继续捕获",
      "Resume network capture": "继续网络捕获",
      "Resize list/detail": "调整列表/详情",
      "Resize request and response panels": "调整请求和响应面板",
      "Resize request list and detail panels": "调整请求列表和详情面板",
      "Resize request/response": "调整请求/响应",
      "Response": "响应",
      "Refresh targets": "刷新目标",
      "Restart Proxy": "重启代理",
      "Proxy restart is available in the Electron app.": "代理重启仅在 Electron App 中可用。",
      "Select provider": "选择供应商",
      "Select a scanned target": "选择扫描到的目标",
      "Selected": "已选择",
      "Service": "服务",
      "Service failed to start": "服务启动失败",
      "Service control is available in the Electron app.": "服务控制仅在 Electron App 中可用。",
      "Scanning targets": "正在扫描目标",
      "Service status": "服务状态",
      "Step": "步骤",
      "Start": "启动",
      "Start service": "启动服务",
      "Stop": "停止",
      "Start using CCR.": "开始使用 CCR。",
      "API Service": "API 服务 (API Service)",
      "Availability": "可用性",
      "Current": "当前",
      "Current version": "当前版本",
      "Current model": "当前模型",
      "Degraded": "降级",
      "Gateway": "网关",
      "Healthy": "正常",
      "Idle": "未启用",
      "Network capture": "网络捕获",
      "Proxy Service": "代理服务",
      "System status": "系统状态",
      "System Proxy": "系统代理",
      "Available version": "可用版本",
      "Latest version": "最新版本",
      "Download update": "下载更新",
      "Downloading update": "正在下载更新",
      "Feed URL": "更新源",
      "Online updates": "在线更新",
      "Release notes": "更新说明",
      "Update available": "发现新版本",
      "Update downloaded": "更新已下载",
      "Update downloaded. Restart to finish updating.": "更新已下载，请重启应用以完成版本更新。",
      "Update failed": "更新失败",
      "Update check complete": "检查完成",
      "Update ready to install": "更新已准备安装",
      "Updates are only available in packaged builds.": "在线更新仅在打包后的应用中可用。",
      "After deletion, this bot data cannot be recovered.": "删除后数据不可恢复。",
      "This bot is being used by the following agents and cannot be deleted.": "当前 Bot 正在被以下 Agent 使用，不能删除。",
      "{count} agent profiles use this bot": "{count} 个 Agent 使用中",
      "This provider link came from an external website. Review details before importing.": "这个供应商链接来自外部网站。导入前请确认下面的内容。",
      "Welcome to CCR": "欢迎使用CCR",
      "Trusted": "已信任",
      "Small fast model": "小模型",
      "Unknown": "未知",
      "Unlimited": "无限制",
      "Unnamed": "未命名",
      "Unnamed provider": "未命名供应商",
      "Unnamed rule": "未命名规则",
      "Untrusted": "未信任",
      "body": "正文",
      "active": "已启用",
      "capturing": "捕获中",
      "decoded": "已解码",
      "disabled": "已禁用",
      "enabled": "已启用",
      "header": "标头",
      "inactive": "未启用",
      "models": "模型",
      "meters": "指标",
      "not running": "未运行",
      "ok": "正常",
      "paused": "已暂停",
      "provider": "供应商",
      "query": "查询",
      "raw": "原始",
      "req": "请求",
      "rule": "规则",
      "starting": "启动中",
      "stopped": "已停止",
      "summary": "摘要",
      "truncated": "已截断",
      "unsupported": "不支持",
      "restored": "已恢复",
      "up": "上",
      "down": "下",
      "per day": "每天",
      "per hour": "每小时",
      "per minute": "每分钟",
      "running": "运行中"
    }
  }
};

export const AppI18nContext = createContext<AppCopy>(appCopy.en);

export function useAppText() {
  const copy = useContext(AppI18nContext);
  return useMemo(() => (value: string) => translateText(copy, value), [copy]);
}

export function useAppNumberLocale(): Intl.LocalesArgument {
  const copy = useContext(AppI18nContext);
  return copy === appCopy.zh ? "zh-CN" : "en-US";
}

export function translateText(copy: AppCopy, value: string): string {
  return copy.text[value] ?? value;
}

export function translateAppErrorMessage(copy: AppCopy, value: string): string {
  return translateErrorMessage(copy === appCopy.zh ? "zh" : "en", translateText(copy, value));
}

export function formatAppError(copy: AppCopy, error: unknown): string {
  return translateAppErrorMessage(copy, error instanceof Error ? error.message : String(error));
}

export function useAppErrorText() {
  const copy = useContext(AppI18nContext);
  return useMemo(() => (error: unknown) => formatAppError(copy, error), [copy]);
}

export function translateOptions<T extends { label: string; value: string }>(options: T[], t: (value: string) => string): T[] {
  return options.map((option) => ({ ...option, label: t(option.label) }));
}
