import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; i18n .use(LanguageDetector) .use(initReactI18next) .init({ fallbackLng: 'en', detection: { order: ['localStorage', 'navigator'], caches: ['localStorage'], lookupLocalStorage: 'lang', }, supportedLngs: ['en', 'zh-CN'], load: 'currentOnly', // Only load the exact language code, not variants resources: { en: { translation: { appName: 'Antigravity Manager', status: { checking: 'Checking status...', running: 'Antigravity is running in background', stopped: 'Antigravity service stopped', }, action: { stop: 'Stop', start: 'Start', switch: 'Switch', deleteBackup: 'Delete Backup', backupCurrent: 'Backup Current', retry: 'Retry', openLogs: 'Open Log Directory', }, error: { generic: 'An unexpected error occurred.', keychainUnavailable: 'Keychain is unavailable.', keychainHint: { translocation: 'Detected macOS App Translocation. Move the app to /Applications and reopen.', keychainDenied: 'Keychain access denied. The app may be unsigned; see README for the self-signing workaround.', signNotarize: 'Please use a signed and notarized build when available.', }, }, nav: { accounts: 'Accounts', proxy: 'API Proxy', settings: 'Settings', }, account: { current: 'Current', lastUsed: 'Last used {{time}}', }, home: { title: 'Accounts', description: 'Manage your Antigravity Google Gemini accounts.', noBackups: { title: 'No backups found', description: 'Create a backup of your current Antigravity account to get started.', action: 'Backup Current Account', }, }, settings: { title: 'Settings', description: 'Manage application preferences.', general: 'General', connection: 'Connection', models: 'Models', appearance: { title: 'Appearance', description: 'Customize how Antigravity Manager looks on your device.', }, darkMode: 'Dark Mode', darkModeDescription: 'Enable dark mode for better viewing at night.', language: { title: 'Language', description: 'Select your preferred language.', english: 'English', chinese: 'Chinese (Simplified)', }, about: { title: 'About', description: 'Application information.', }, version: 'Version', platform: 'Platform', license: 'License', openLogDir: 'Open', account: { title: 'Account Settings', description: 'Configure automatic account refresh and sync.', auto_refresh: 'Auto Refresh Quota', auto_refresh_desc: 'Periodically refresh quota info for all accounts', auto_sync: 'Auto Sync Current Account', auto_sync_desc: 'Periodically sync active account information', }, proxy: { title: 'Upstream Proxy', description: 'Configure a proxy for outgoing requests to Google/Gemini APIs.', enable: 'Enable Upstream Proxy', url: 'Proxy URL', timeout: 'Request Timeout (Seconds)', }, modelMapping: { title: 'Model Mapping', description: 'Map Claude Code models to Antigravity models. Optimize cost and speed by routing requests intelligently.', claudeKeyword: 'Claude Model (Keyword)', targetGemini: 'Target Gemini Model', addPlaceholderKey: 'e.g. op-3', addPlaceholderValue: 'e.g. gemini-2.0-flash-exp', noMappings: 'No custom mappings defined.', mapsTo: 'Maps to', default: 'Default', restoreDefaults: 'Restore Defaults', }, examples: { title: 'Usage Examples', description: 'Example commands to call the local API proxy.', curl: 'cURL', python: 'Python', copy: 'Copy', copied: 'Copied!', openai_protocol: 'OpenAI Protocol', anthropic_protocol: 'Anthropic Protocol', openai_tools: 'Cursor, Windsurf, NextChat', anthropic_tools: 'Claude Code CLI', flash: 'Fast', pro: 'Pro', flash_preview: 'Preview', pro_high: 'Best', sonnet: 'Thinking', opus: 'Opus', }, gateway: { title: 'API Proxy Service', description: 'Control the local API proxy server.', status_running: 'Running', status_stopped: 'Stopped', action_start: 'Start Service', action_stop: 'Stop Service', accounts_info: '{{count}} accounts available', port: 'Listen Port', port_hint: 'Default 8045, restart required to apply changes', timeout: 'Request Timeout', timeout_hint: 'Default 120s, range 30-600s', api_key: 'API Key', regenerate_key: 'Regenerate', regenerateConfirm: { title: 'Regenerate API Key?', description: 'This will invalidate the current API key immediately. Any applications using the old key will stop working.', cancel: 'Cancel', confirm: 'Regenerate', }, key_warning: 'Keep your API key secure. Do not share it.', auto_start: 'Auto Start with App', auto_start_desc: 'Start proxy service when application launches', }, proxy_tab: 'Proxy', save: 'Save Settings', }, toast: { backupSuccess: { title: 'Success', description: 'Account backup created successfully.', }, backupError: { title: 'Error', description: 'Failed to create backup: {{error}}', }, switchSuccess: { title: 'Success', description: 'Switched account successfully.', }, switchError: { title: 'Error', description: 'Failed to switch account: {{error}}', }, deleteSuccess: { title: 'Success', description: 'Account backup deleted successfully.', }, deleteError: { title: 'Error', description: 'Failed to delete backup: {{error}}', }, }, cloud: { title: 'Accounts', description: 'Manage your Google Gemini account pool.', autoSwitch: 'Auto-Switch', addAccount: 'Add Account', syncFromIDE: 'Sync from IDE', checkQuota: 'Check Quota Now', polling: 'Polling triggered', authDialog: { title: 'Add Google Account', description: 'To add an account, you need to authorize the application.', openLogin: 'Open Login Page', authCode: 'Authorization Code', placeholder: 'Paste the code starting with 4/...', instruction: 'Will open default browser for Google login. Copy the code from localhost page and paste here.', verify: 'Verify & Add', }, card: { active: 'Active', use: 'Use', rateLimited: 'Rate Limited', left: 'left', used: 'Used', unknown: 'Unknown User', actions: 'Actions', useAccount: 'Use Account', refresh: 'Refresh Quota', delete: 'Delete Account', noQuota: 'No quota data', }, list: { noAccounts: 'No cloud accounts added yet.', }, toast: { syncSuccess: { title: 'Sync Successful', description: 'Imported {{email}} from IDE.', }, syncFailed: { title: 'Sync Failed', description: 'No active account found in IDE database.', }, addSuccess: 'Account added successfully!', addFailed: { title: 'Failed to add account', }, quotaRefreshed: 'Quota refreshed', refreshFailed: 'Failed to refresh quota', switched: { title: 'Account switched!', description: 'Restarting Antigravity...', }, switchFailed: 'Failed to switch account', deleted: 'Account deleted', deleteFailed: 'Failed to delete account', deleteConfirm: 'Are you sure you want to delete this account?', autoSwitchOn: 'Auto-Switch Enabled', autoSwitchOff: 'Auto-Switch Disabled', updateSettingsFailed: 'Failed to update settings', }, batch: { selected: 'Selected {{count}}', delete: 'Delete Selected', refresh: 'Refresh Selected', selectAll: 'Select All', clear: 'Clear Selection', confirmDelete: 'Are you sure you want to delete {{count}} accounts?', }, }, proxy: { title: 'API Proxy', description: 'Manage the local API proxy service.', save: 'Save Settings', copy: 'Copy', regenerate: 'Regenerate', regenerateConfirm: { title: 'Regenerate API Key?', description: 'This will invalidate the current API key immediately. Any applications using the old key will stop working.', cancel: 'Cancel', confirm: 'Regenerate', }, service: { title: 'Service Status', description: 'Control the local API proxy server.', running: 'Running', stopped: 'Stopped', start: 'Start Service', stop: 'Stop Service', }, config: { port: 'Listen Port', timeout: 'Request Timeout', api_key: 'API Key', auto_start: 'Auto Start with App', auto_start_desc: 'Start proxy service when application launches', }, mapping: { title: 'Model Mapping', description: 'Map Claude models to Gemini models for routing.', maps_to: 'Maps to', restore: 'Restore Defaults', }, examples: { title: 'Usage Examples', description: 'Example commands to call the local API proxy.', }, }, }, }, 'zh-CN': { translation: { appName: 'Antigravity 管理器', status: { checking: '正在检查状态...', running: 'Antigravity 正在后台运行', stopped: 'Antigravity 服务已停止', }, action: { stop: '停止', start: '启动', switch: '切换', deleteBackup: '删除备份', backupCurrent: '备份当前账号', retry: '重试', openLogs: '打开日志目录', }, error: { generic: '发生未知错误。', keychainUnavailable: 'Keychain 不可用。', keychainHint: { translocation: '检测到 macOS App Translocation。请将应用移动到 /Applications 后重试。', keychainDenied: 'Keychain 访问被拒绝。应用可能未签名,可参考 README 的“macOS 自签”说明。', signNotarize: '请在可用时使用已签名并公证的版本。', }, }, nav: { accounts: '账号', proxy: 'API 反代', settings: '设置', }, account: { current: '当前', lastUsed: '上次使用 {{time}}', }, home: { title: '账号列表', description: '管理您的 Antigravity Google Gemini 账号。', noBackups: { title: '未找到备份', description: '备份您当前的 Antigravity 账号以开始使用。', action: '备份当前账号', }, }, settings: { title: '设置', description: '管理应用偏好设置。', general: '常规', connection: '连接', models: '模型', appearance: { title: '外观', description: '自定义 Antigravity 管理器在您设备上的显示方式。', }, darkMode: '深色模式', darkModeDescription: '启用深色模式以获得更好的夜间观看体验。', language: { title: '语言', description: '选择您的首选语言。', english: '英语', chinese: '中文 (简体)', }, about: { title: '关于', description: '应用信息。', }, version: '版本', platform: '平台', license: '许可证', openLogDir: '打开', account: { title: '账号设置', description: '配置自动刷新和同步账号。', auto_refresh: '自动刷新配额', auto_refresh_desc: '定期自动刷新所有账号的配额信息', auto_sync: '自动获取当前账号', auto_sync_desc: '定期自动同步当前活跃账号信息', }, proxy: { title: '上游代理', description: '为发往 Google/Gemini API 的请求配置代理。', enable: '启用上游代理', url: '代理地址', timeout: '请求超时 (秒)', }, modelMapping: { title: '模型映射', description: '将 Claude Code 模型映射到 Antigravity 模型,智能路由请求以优化成本和速度。', claudeKeyword: 'Claude 模型 (关键词)', targetGemini: '目标 Gemini 模型', addPlaceholderKey: '例如 op-3', addPlaceholderValue: '例如 gemini-2.0-flash-exp', noMappings: '暂无自定义映射。', mapsTo: '映射到', default: '默认', restoreDefaults: '恢复默认配置', }, examples: { title: '使用示例', description: '调用本地 API 代理的示例命令。', curl: 'cURL', python: 'Python', copy: '复制', copied: '已复制!', openai_protocol: 'OpenAI 协议', anthropic_protocol: 'Anthropic 协议', openai_tools: 'Cursor, Windsurf, NextChat', anthropic_tools: 'Claude Code CLI', flash: '极速', pro: '专业版', flash_preview: '预览版', pro_high: '最强', sonnet: '思维链', opus: 'Opus', }, gateway: { title: 'API 反代服务', description: '控制本地 API 代理服务器。', status_running: '运行中', status_stopped: '已停止', action_start: '启动服务', action_stop: '停止服务', accounts_info: '{{count}} 个账号可用', port: '监听端口', port_hint: '默认 8045,修改端口需重启服务', timeout: '请求超时', timeout_hint: '默认 120 秒,范围 30-600 秒', api_key: 'API 密钥', regenerate_key: '重新生成', regenerateConfirm: { title: '重新生成 API 密钥?', description: '这将立即废除当前 API 密钥。任何使用旧密钥的应用将无法继续工作。', cancel: '取消', confirm: '重新生成', }, key_warning: '请妥善保管您的 API 密钥,不要泄露给他人。', auto_start: '跟随应用自动启动', auto_start_desc: '应用启动时自动启动代理服务', }, proxy_tab: '反代', save: '保存设置', }, toast: { backupSuccess: { title: '成功', description: '账号备份创建成功。', }, backupError: { title: '错误', description: '创建备份失败:{{error}}', }, switchSuccess: { title: '成功', description: '切换账号成功。', }, switchError: { title: '错误', description: '切换账号失败:{{error}}', }, deleteSuccess: { title: '成功', description: '账号备份删除成功。', }, deleteError: { title: '错误', description: '删除备份失败:{{error}}', }, }, cloud: { title: '账号列表', description: '管理您的 Google Gemini 账号池。', autoSwitch: '自动切换', addAccount: '添加账号', syncFromIDE: '从 IDE 同步', checkQuota: '立即检查配额', polling: '已触发轮询', authDialog: { title: '添加 Google 账号', description: '添加账号需要进行应用授权。', openLogin: '打开登录页面', authCode: '授权码', placeholder: '粘贴以 4/ 开头的代码...', instruction: '将打开默认浏览器进行 Google 登录授权,自动获取并保存 Token。', verify: '验证并添加', }, card: { active: '活跃', use: '使用', rateLimited: '受限', left: '剩余', used: '已用', unknown: '未知用户', actions: '操作', useAccount: '使用账号', refresh: '刷新配额', delete: '删除账号', noQuota: '无配额数据', }, list: { noAccounts: '暂无云账号。', }, toast: { syncSuccess: { title: '同步成功', description: '已从 IDE 导入 {{email}}。', }, syncFailed: { title: '同步失败', description: 'IDE 数据库中未找到活跃账号。', }, addSuccess: '账号添加成功!', addFailed: { title: '添加账号失败', }, quotaRefreshed: '配额已刷新', refreshFailed: '刷新配额失败', switched: { title: '账号已切换!', description: '正在重启 Antigravity...', }, switchFailed: '切换账号失败', deleted: '账号已删除', deleteFailed: '删除账号失败', deleteConfirm: '确定要删除此账号吗?', autoSwitchOn: '自动切换已启用', autoSwitchOff: '自动切换已禁用', updateSettingsFailed: '更新设置失败', }, batch: { selected: '已选 {{count}} 项', delete: '删除选中', refresh: '刷新选中', selectAll: '全选', clear: '取消选择', confirmDelete: '确定要删除选中的 {{count}} 个账号吗?', }, }, proxy: { title: 'API 反代', description: '管理本地 API 代理服务。', save: '保存设置', copy: '复制', regenerate: '重新生成', regenerateConfirm: { title: '重新生成 API 密钥?', description: '这将立即废除当前 API 密钥。任何使用旧密钥的应用将无法继续工作。', cancel: '取消', confirm: '重新生成', }, service: { title: '服务状态', description: '控制本地 API 代理服务器。', running: '运行中', stopped: '已停止', start: '启动服务', stop: '停止服务', }, config: { port: '监听端口', timeout: '请求超时', api_key: 'API 密钥', auto_start: '随应用启动', auto_start_desc: '应用启动时自动启动代理服务', local_access: '局域网访问:', no_token_warning: '⚠️ 未设置 API 密钥。服务对公网开放!', show_key: '显示密钥', hide_key: '隐藏密钥', }, mapping: { title: '模型映射', description: '将 Claude 模型映射到 Gemini 模型进行路由。', maps_to: '映射到', restore: '恢复默认', }, examples: { title: '使用示例', description: '调用本地 API 代理的示例命令。', }, }, }, }, }, });