/** * @fileoverview Dependency-free browser localization and user-facing branding. * * English remains the canonical source language. The translator covers the static * application shell plus DOM content inserted later by the plain-JS UI modules. * It deliberately skips terminal/file/response/user-name surfaces so user content * is never mistaken for application copy. Missing entries fall back to English. * * @dependency none (loads after constants.js, before all UI modules) * @loadorder 1.5 of 16 */ (function initCodemanI18n(global) { 'use strict'; const DEFAULT_NAME = 'Codeman'; const SUPPORTED_LANGUAGES = new Set(['en', 'zh-CN']); const TRANSLATABLE_ATTRIBUTES = ['title', 'aria-label', 'placeholder']; const SKIP_SELECTOR = [ '[data-i18n-skip]', '.xterm', '.terminal-container', '.terminal-output', '.response-content', '.response-viewer-content', '.file-preview-content', '.session-tab-name', '.session-name', '.case-name', '.notif-item-message', 'pre', 'code', 'script', 'style', 'textarea', ].join(','); const USER_TEXT_SELECTOR = [ '.history-item-title', '.history-item-subtitle', '.history-detail-prompt', '.history-detail-path', '.folder-history-subtitle', ].join(','); // Exact English-source translations. Technical names, command examples, model // names, keyboard chords, and user-authored content intentionally stay unchanged. const ZH_CN = Object.freeze({ 'Skip to terminal': '跳转到终端', 'Go to main page': '返回主页', 'Session tabs': '会话标签页', /* 'Sessions' (the sidebar heading) is already mapped further down. */ 'Collapse session sidebar': '收起会话侧边栏', 'Expand session sidebar': '展开会话侧边栏', 'Filter sessions': '筛选会话', 'Admin Panel': '管理面板', 'Open admin panel': '打开管理面板', 'Re-dock to dashboard (close window)': '重新停靠到主界面(关闭窗口)', 'Tunnel status': '隧道状态', 'Decrease font size': '减小字体', 'Increase font size': '增大字体', 'Current font size': '当前字体大小', 'System resource usage': '系统资源使用情况', 'Redraw terminal': '重绘终端', 'Redraw terminal to fit current screen (Ctrl+Shift+R)': '重绘终端以适应当前屏幕(Ctrl+Shift+R)', 'View last response': '查看最近一次回复', 'Away Digest': '离开期间摘要', 'Open away digest': '打开离开期间摘要', 'Session Manager': '会话管理器', 'Session actions': '会话操作', 'Open session manager': '打开会话管理器', Attachments: '附件', 'Open attachment history': '打开附件历史', 'File Viewer': '文件查看器', 'Open file viewer': '打开文件查看器', 'Open Codeman across all displays': '在所有显示器上打开 {name}', 'Split: open a second session beside this one': '分屏:在旁边打开第二个会话', 'Split: close the second session': '分屏:关闭第二个会话', 'Close split': '关闭分屏', 'No other sessions to split with': '没有其他可用于分屏的会话', 'Ultracode / Workflow agents': 'Ultracode / Workflow 智能体', 'Open ultracode workflow agents': '打开 Ultracode 工作流智能体', Notifications: '通知', 'Toggle notifications': '切换通知面板', 'Session Lifecycle Log': '会话生命周期日志', 'Open session lifecycle log': '打开会话生命周期日志', 'App Settings': '应用设置', 'Open app settings': '打开应用设置', 'Total tokens across all sessions': '所有会话的 Token 总数', 'Token usage across active sessions': '活动会话的 Token 使用量', 'Instance count': '实例数量', 'No response yet': '暂无回复', 'No response yet — send a message in this session first.': '暂无回复,请先在此会话中发送一条消息。', 'No full conversation history available for this session': '此会话没有可显示的完整对话历史', 'Last Response': '最近一次回复', More: '更多', 'Codeman version': '{name}版本', Stop: '停止', Watching: '监视中', Orchestrator: '编排器', Close: '关闭', 'Close window': '关闭窗口', 'Session unavailable': '会话不可用', 'This session has ended or is no longer available.': '此会话已结束或不再可用。', // Welcome / quick start / common actions 'Manage AI Coding tools in persistent tmux sessions.': '在持久化 tmux 会话中管理 AI 编程工具。', 'Select case': '选择案例', 'Select Case': '选择案例', 'Search cases': '搜索案例', 'No matching cases': '没有匹配的案例', 'All cases': '全部案例', 'No directory': '未选择目录', Run: '运行', 'Run Claude Code': '运行 Claude Code', 'Run OpenCode': '运行 OpenCode', 'Run Codex': '运行 Codex', 'Run Gemini': '运行 Gemini', 'Run Antigravity': '运行 Antigravity', 'Run Pi': '运行 Pi', 'Run Grok': '运行 Grok', 'Run DeepSeek': '运行 DeepSeek', 'Run OMP': '运行 OMP', 'Run Shell': '运行 Shell', 'Select AI backend': '选择 AI 后端', 'Create New Case': '新建案例', 'Create new case': '新建案例', 'Link Existing': '关联现有目录', 'Add Case': '添加案例', 'Open sessions': '打开会话', 'Recent Sessions': '最近会话', 'Search sessions by name, prompt, or path…': '按名称、提示词或路径搜索会话…', 'Search open sessions or start a new one': '搜索已打开会话或启动新会话', 'Find Open Session': '查找已打开会话', 'No background agents': '没有后台智能体', 'No background agents detected': '未检测到后台智能体', 'No notifications': '没有通知', 'No mux sessions': '没有 mux 会话', 'No lifecycle entries found': '未找到生命周期记录', 'No ultracode runs detected': '未检测到 Ultracode 运行', // Global/common controls Display: '显示', 'Claude CLI': 'Claude CLI', 'Codex CLI': 'Codex CLI', Models: '模型', Shortcuts: '快捷键', Voice: '语音', Save: '保存', Cancel: '取消', Apply: '应用', Create: '创建', Add: '添加', Delete: '删除', Remove: '移除', Edit: '编辑', Refresh: '刷新', Back: '返回', Next: '下一步', Previous: '上一步', Clear: '清除', 'Clear all': '全部清除', 'Clear All': '全部清除', Search: '搜索', Filter: '筛选', Enable: '启用', Enabled: '已启用', Disabled: '已禁用', Active: '活动', 'Not active': '未活动', On: '开', Off: '关', Yes: '是', No: '否', Optional: '可选', Default: '默认', Custom: '自定义', Name: '名称', Description: '描述', Status: '状态', Reason: '原因', Time: '时间', Event: '事件', Events: '事件', Session: '会话', Sessions: '会话', Files: '文件', History: '历史', Summary: '摘要', Details: '详情', Options: '选项', Settings: '设置', Help: '帮助', Loading: '正在加载', Error: '错误', Errors: '错误', Warning: '警告', Warnings: '警告', Info: '信息', Complete: '完成', Completed: '已完成', Stopped: '已停止', Running: '运行中', Idle: '空闲', Working: '工作中', Today: '今天', Home: '主页', Local: '本地', Remote: '远程', Docker: 'Docker', Terminal: '终端', Prompt: '提示词', Source: '来源', Type: '类型', Language: '语言', // Display settings 'Branding & Language': '品牌与语言', 'Display Name': '显示名称', 'Interface Language': '界面语言', 'Name shown in the browser UI and window title. Supports Unicode, including Chinese.': '显示在浏览器界面和窗口标题中的名称。支持 Unicode,包括中文。', 'Language for this device. Dynamic status messages and dialogs use the same language.': '此设备使用的界面语言。动态状态消息与对话框也会使用同一语言。', English: 'English', Appearance: '外观', Skin: '皮肤', 'Visual theme for this device (not synced)': '此设备的视觉主题(不同步)', 'Daylight Blue': '日光蓝', 'Daylight Green': '日光绿', 'OG Codeman': '经典 {name}', Performance: '性能', 'WebGL Renderer': 'WebGL 渲染器', 'Header Displays': '顶部栏显示', 'Font Controls': '字体控制', 'System Stats': '系统状态', 'Lifecycle Log': '生命周期日志', 'Response Viewer': '回复查看器', 'Attachments Button': '附件按钮', 'Multi-monitor Button': '多显示器按钮', 'Session Manager Button': '会话管理器按钮', 'Away Digest Button': '离开期间摘要按钮', 'Cron Button': '定时任务按钮', 'Redraw Terminal Button': '重绘终端按钮', 'Tab Bar': '标签栏', 'Session List Layout': '会话列表布局', 'Session Name Font Size': '会话名称字体大小', 'Adjust only session names in the vertical sidebar.': '仅调整垂直侧边栏中的会话名称。', 'Header tab strip': '顶栏标签条', 'Left sidebar': '左侧边栏', 'Left sidebar simple': '左侧边栏(简洁)', 'Horizontal strip in the header, or a collapsible left sidebar (Alt+B). The rich sidebar carries the same per-session detail as the home screen.': '会话列表显示为顶栏横向标签条,或左侧可折叠侧边栏(Alt+B)。完整侧边栏为每个会话显示与主界面相同的详细信息。', 'Tall Tabs (Name + Folder)': '双行标签(名称 + 文件夹)', 'Pop-out Button on Tabs': '标签页弹出窗口按钮', Panels: '面板', Monitor: '监视器', 'Project Insights': '项目洞察', 'File Browser': '文件浏览器', Subagents: '子智能体', 'Ultracode Agents': 'Ultracode 智能体', 'Ultracode Floating Windows': 'Ultracode 浮动窗口', 'Approvals Inbox': '审批收件箱', 'Auto-name Sessions': '自动命名会话', Approvals: '审批', 'Prompts waiting on you, across all sessions': '所有会话中等待您处理的提示', 'No pending approvals': '没有待处理的审批', 'Approvals waiting on you': '等待您审批的请求', 'Open approvals inbox': '打开审批收件箱', 'Close approvals inbox': '关闭审批收件箱', Approve: '批准', 'Deny (Esc)': '拒绝 (Esc)', Deny: '拒绝', 'Open session': '打开会话', Dismiss: '忽略', Send: '发送', Permission: '权限', Question: '问题', Idle: '空闲', 'Read My Mind': '读心术', 'Read My Mind: predict your next prompt': '读心术:预测您的下一条提示', 'Predict my next prompt': '预测我的下一条提示', 'Reading your mind…': '正在读取您的想法…', 'No suggestion this time. Add a steer note and Rethink to try again.': '这次没有建议。可添加引导备注后点击「重想」再试一次。', Rethink: '重想', Insert: '插入', "Put the text on the session's composer without submitting it": '将文本放入会话输入框但不提交', 'Predicted prompt, editable': '预测的提示,可编辑', 'Use this suggestion instead': '改用此建议', "Steer the rethink, e.g. 'no, I meant the mobile bug'": '引导重想,例如:"不,我是指移动端的问题"', 'Steer note for Rethink': '重想的引导备注', 'Select a session first': '请先选择一个会话', 'Read My Mind works on Claude sessions only': '读心术仅适用于 Claude 会话', 'Prompt sent': '提示已发送', 'Inserted, press Enter in the terminal to send': '已插入,在终端中按 Enter 发送', 'Could not reach the session': '无法连接到会话', 'Custom model endpoints': '自定义模型端点', 'Point a harness at your own OpenAI-compatible server (llama.cpp, vLLM, DGX Spark, Azure AI Foundry, OpenRouter) instead of its native cloud backend. When on, the Run menu offers an extra entry per harness that supports it, per saved endpoint.': '让工具指向您自己的兼容 OpenAI 服务器(llama.cpp、vLLM、DGX Spark、Azure AI Foundry、OpenRouter),而非其原生云端后端。开启后,"运行"菜单会为每个支持此功能的工具、每个已保存的端点新增一个条目。', 'Enable custom model endpoints': '启用自定义模型端点', 'Adds a per-endpoint entry to the Run menu for every harness that can redirect to one.': '为每个可重定向到端点的工具,在"运行"菜单中添加对应条目。', 'No endpoints yet. Add one below to point a harness at a local or cloud OpenAI-compatible server.': '暂无端点。请在下方添加一个,以便将工具指向本地或云端的兼容 OpenAI 服务器。', Discover: '发现模型', '+ Add endpoint': '+ 添加端点', 'Add endpoint': '添加端点', Id: 'ID', 'Short, stable — used in URLs, never shown to the CLI.': '简短且固定 — 用于 URL,不会展示给 CLI。', Label: '标签', 'Base URL': '基础 URL', 'API key': 'API 密钥', 'Optional. Left blank on edit keeps the existing key.': '可选。编辑时留空将保留现有密钥。', 'Auth header': '认证请求头', 'Never send both — some servers hang indefinitely.': '切勿同时发送两者 — 部分服务器会因此无限期挂起。', 'Authorization: Bearer (default)': 'Authorization: Bearer(默认)', 'api-key header (Azure)': 'api-key 请求头(Azure)', 'Default model': '默认模型', 'What the Run-menu picker applies for this endpoint. Discover models first.': '运行菜单选择器会为此端点应用该模型。请先发现可用模型。', 'Custom Endpoints': '自定义端点', 'Choose a model': '选择模型', 'Currently loaded': '当前已加载', 'Last used': '上次使用', 'That endpoint no longer exists': '该端点已不存在', 'No models discovered for this endpoint yet': '此端点尚未发现任何模型', 'Subagent Options': '子智能体选项', 'Enable Tracking': '启用跟踪', 'Active Tab Only': '仅活动标签页', 'Image Watcher': '图像监视器', 'Enable Globally': '全局启用', 'Remote Access': '远程访问', 'Cloudflare Tunnel': 'Cloudflare 隧道', 'Tunnel URL': '隧道地址', 'Upload URL': '上传地址', Updates: '更新', 'Current Version': '当前版本', 'Check for Updates': '检查更新', 'Check now': '立即检查', 'Update available': '有可用更新', 'Update now': '立即更新', 'Show CPU and memory usage in header': '在顶部栏显示 CPU 与内存使用情况', 'Show session lifecycle log button in header': '在顶部栏显示会话生命周期日志按钮', 'Show the response viewer (eye) button in header': '在顶部栏显示回复查看器(眼睛)按钮', 'Show the file viewer button in header (opens the file browser panel for the active session)': '在顶部栏显示文件查看器按钮(打开当前会话的文件浏览器面板)', 'Show the attachments button in header (opens the attachment history drawer)': '在顶部栏显示附件按钮(打开附件历史抽屉)', 'Show the multi-monitor button in the header (opens Codeman spanned across all displays)': '在顶部栏显示多显示器按钮(跨所有显示器打开 {name})', 'Show the session manager button in the header (opens the session manager — sessions also stay reachable via the Ctrl+K palette)': '在顶部栏显示会话管理器按钮(也可通过 Ctrl+K 面板访问会话)', "Show the away digest button in the header (opens the 'what happened while you were away' summary)": '在顶部栏显示离开期间摘要按钮', 'Show the Cron button in the footer toolbar (opens the cron jobs manager)': '在底部工具栏显示定时任务按钮', 'Show a terminal redraw button in the header — refit the terminal to the current screen size (useful when switching between devices)': '在顶部栏显示终端重绘按钮,以重新适配当前屏幕大小', 'Show folder path below tab name and allow tab bar to wrap into multiple rows': '在标签名称下显示文件夹路径,并允许标签栏换行', 'Show Monitor panel at bottom right': '在右下角显示监视器面板', 'Show active tools and file viewers in a floating panel': '在浮动面板中显示活动工具与文件查看器', 'Show file browser panel on the right side': '在右侧显示文件浏览器面板', 'Show the Subagents panel (independent from Monitor)': '显示子智能体面板(独立于监视器)', 'Monitor Claude Code background agents in real-time': '实时监视 Claude Code 后台智能体', 'Only show subagent windows when their parent tab is selected': '仅在选中父标签页时显示子智能体窗口', 'Automatically detect and popup new images in session directories': '自动检测并弹出会话目录中的新图像', 'Expose Codeman via Cloudflare Tunnel for remote access': '通过 Cloudflare 隧道远程访问 {name}', 'Codeman version currently running': '当前运行的{name}版本', 'Check GitHub for a newer Codeman release': '检查 GitHub 上是否有新版 {name}', // Input settings Input: '输入', Font: '字体', 'Terminal font': '终端字体', 'Prepended to the built-in stack, so fallbacks (including bundled Nerd Font symbols) keep working. Must be installed on this device. Leave empty for the default.': '置于内置字体栈之前,回退字体(包括内置的 Nerd Font 图标)仍然生效。需已安装在本设备上。留空使用默认值。', 'Normal font weight': '常规字重', 'Weight for ordinary terminal text. Lowering it widens the step up to bold, which for a family shipping only a regular and a bold face is the only cue bold text carries. Needs a family with faces at that weight; the bundled font covers 100 to 800.': '终端普通文本的字重。调低可拉大与粗体之间的差距;对于只提供常规和粗体两种字形的字体,这一差距是粗体文本唯一的视觉提示。需要字体具备该字重的字形,内置字体覆盖 100 至 800。', 'Bold font weight': '粗体字重', 'Weight for bold terminal text. Only useful with a family carrying something heavier than its bold face.': '终端粗体文本的字重。仅当字体提供比其粗体更重的字形时才有意义。', 'Local Echo': '本地回显', 'CJK Input': '中日韩输入', 'Extended Keyboard Bar': '扩展键盘栏', 'Gesture Control (beta)': '手势控制(测试版)', 'Wheel Scrolls Local History': '滚轮滚动本地历史', 'Auto Copy Selection': '自动复制选中内容', 'Selection & clipboard': '选中与剪贴板', 'Auto Copy: selection copied': '自动复制:已复制选中内容', 'Auto Copy failed: the browser blocked clipboard access': '自动复制失败:浏览器阻止了剪贴板访问', 'Selection too large to copy automatically. Press Ctrl+C.': '选中内容过大,无法自动复制。请按 Ctrl+C。', 'Instant typing feedback with local echo': '通过本地回显即时显示输入', 'Dedicated IME input field for CJK languages': '为中日韩语言提供专用输入法文本框', 'Extra keys: Tab, Esc, arrows, Ctrl+O': '附加按键:Tab、Esc、方向键、Ctrl+O', // CLI / model settings 'Startup Mode': '启动模式', 'Skip Permissions (default)': '跳过权限确认(默认)', 'Auto (classifier-guarded, low prompts)': '自动(分类器保护,较少提示)', 'Normal (with prompts)': '普通(显示提示)', 'Allowed Tools Only': '仅允许指定工具', 'Allowed Tools': '允许的工具', 'Comma-separated list of tools to allow': '以逗号分隔允许使用的工具', 'Enable Ralph / Todo Tracker': '启用 Ralph / 待办跟踪器', 'Claude Permissions': 'Claude 权限', 'Agent Teams': '智能体团队', 'Claude Model': 'Claude 模型', '1M Opus Context': 'Opus 100 万上下文', 'Remote auto-reconnect': '远程自动重连', 'Thinking Effort': '思考强度', Low: '低', Medium: '中', High: '高', Max: '最高', 'Nice Priority': 'Nice 优先级', 'Enable Nice Priority Reduction': '启用 Nice 优先级调整', 'Nice Value': 'Nice 值', 'Bypass Approvals and Sandbox': '绕过审批与沙箱', 'Default Model': '默认模型', 'Show Optimizer Recommendations': '显示优化器建议', 'Agent Type Overrides': '按智能体类型覆盖', 'Use Default': '使用默认值', // Notifications / voice / shortcuts 'Enable Notifications': '启用通知', 'Master toggle for all notification layers': '所有通知层的总开关', 'Browser Notifications': '浏览器通知', 'Audio Alerts': '声音提醒', 'Push Notifications': '推送通知', 'Notification Levels': '通知级别', Critical: '严重', 'Per-Event Settings': '按事件设置', 'Permission prompts': '权限提示', 'Questions from Claude': 'Claude 提问', 'Session idle': '会话空闲', 'Response complete': '回复完成', 'Respawn cycles': '重生循环', 'Task complete': '任务完成', 'Subagent activity': '子智能体活动', Browser: '浏览器', Audio: '声音', Push: '推送', 'Voice Input': '语音输入', Provider: '服务商', 'Active Provider': '当前服务商', 'API Key': 'API 密钥', 'Domain Keywords': '领域关键词', 'Input Mode': '输入模式', 'Direct to input': '直接输入', 'Compose dialog': '编辑对话框', 'Keyboard Shortcuts': '键盘快捷键', 'Customize keyboard shortcuts. Click the binding to capture a new key combination.': '自定义键盘快捷键。点击按键组合即可录入新的组合。', 'Show Shortcuts': '显示快捷键', 'Full shortcut reference': '完整快捷键参考', // Mobile prompt composer (keyboard-accessory.js). The textarea's own // placeholder and label are looked up by the module at build time, since // the DOM translator skips