/** Chat-owned locale namespace and dictionaries. */

/** Namespace for Chat target, node, statistics, and details copy. */
export const NS = 'chat'

/** Simplified Chinese dictionary and key-set source of truth. */
export const zh = {
  'view.chat': '对话',
  'number.groupSeparator': ',',
  'duration.compactSeconds': '{seconds}秒',
  'duration.compactMinutes': '{minutes}分{seconds}秒',
  'duration.milliseconds': '{milliseconds}毫秒',
  'stats.counts': '{turns} 轮 · {steps} 步',
  'stats.llm': 'LLM {duration}',
  'stats.toolCall': '工具调用 {duration}',
  'stats.ttftAverage': '首 token 平均 {duration}',
  'stats.tokensPerSecond': '{throughput} tok/s',
  'stats.cacheHit': '缓存命中 {percent}%',
  'stats.tokens': '输入 {input} tok · 输出 {output} tok',
  'details.title': '详情',
  'details.close': '关闭详情',
  'details.empty': '点击消息流中的工具行查看详情',
  'details.notInWindow': '该调用不在当前窗口内',
  'details.input': '输入',
  'details.output': '输出',
  'details.running': '运行中…',
  'chat.loadingHistory': '载入历史…',
  'chat.loadError': '历史加载失败：{message}（{code}）',
  'chat.loadOlder': '加载更早',
  'chat.toBottom': '回到底部',
  'chat.deepDiving': '深度求索中...',
  'chat.turnNavigation.label': '轮次导航',
  'chat.turnNavigation.jump': '跳转到第 {turn} 轮',
  'chat.turnNavigation.turn': '第 {turn} 轮',
  'settings.transcript.title': '对话显示',
  'settings.transcript.description': '控制已完成轮次的过程内容',
  'settings.transcript.normal': 'Normal',
  'settings.transcript.compact': 'Compact',
  'fileOpen.title': '无法打开文件',
  'fileOpen.unknown': '无法打开此文件',
  'fileOpen.folderTitle': '无法打开文件夹',
  'fileOpen.folderUnknown': '无法打开此文件夹',
  'message.extraBlock': '附加内容块',
  'message.systemPrompt': '系统提示词',
  'message.contextInjection': '上下文注入',
  'message.contextRecall': '跨会话召回',
  'message.referenceSummary': '引用会话 · {labels}',
  'message.referenceSeparator': '、',
  'message.context.instructions.loaded': '已载入',
  'message.context.instructions.added': '已新增',
  'message.context.instructions.updated': '已更新',
  'message.context.instructions.removed': '已移除',
  'message.context.catalog.replaced': '替换目录',
  'message.context.catalog.more': '…还有 {count} 条',
  'message.context.snapshot.supersedes': '取代先前的快照',
  'message.context.relay.from': '来自会话 {session}',
  'message.context.recall.counts': '保留 {retained} 条 · 省略 {omitted} 条',
  'message.context.recall.truncated': '已截断',
  'message.compaction': '上下文已压缩',
  'message.compaction.running': '正在压缩…',
  'message.compaction.completed': '已压缩 {items} 条历史记录（约 {tokens} tokens）',
  'message.compaction.expand': '点击查看压缩摘要',
  'message.compaction.unavailable': '压缩摘要不可用',
  'message.compaction.commandTitle': 'compact',
  'message.think': '思考',
  'message.unknownSurface': '未知 surface 事件：{type}',
  'message.unknownBlock': '未知内容块',
  'message.turnProcess.toolCalls.one': '{count} 次工具调用',
  'message.turnProcess.toolCalls.other': '{count} 次工具调用',
  'message.turnProcess.messages.one': '{count} 条消息',
  'message.turnProcess.messages.other': '{count} 条消息',
  'message.turnProcess.subagents.one': '{count} 个 subagent',
  'message.turnProcess.subagents.other': '{count} 个 subagent',
  'message.turnProcess.thoughtForAWhile': '已思考',
  'message.turnProcess.separator': ' · ',
  'message.stopped': '已停止',
  'message.branch': '在新对话中分支',
  'message.branchUnavailable': '仅可从已完成轮次的最后一条消息分支',
  'message.retry.active': '正在重试模型请求',
  'message.retry.cancelled': '模型请求重试已取消',
  'message.retry.started': '已重试模型请求',
  'message.retry.scheduled': '等待重试模型请求',
  'message.retry.status': '{label}（{retry}/{maximum}） · {seconds}s',
  'message.retry.delay': '重试延迟：',
  'message.retry.failure': '失败原因：',
  'message.failure.auth': 'API 密钥无效',
  'message.turnError': '本轮运行失败',
  'message.maxTokens': '已达到输出 token 上限',
  'message.maxTokens.hint': '回答被截断，已有输出保留在对话中。发送“继续”可让模型接着输出。',
  'message.ranFor': '用时 {duration}',
  'message.ttft': '首 token {seconds}秒',
  'message.tokensPerSecond': '{tps} tok/s',
  'message.turnUsage.title': '本轮用量',
  'message.turnUsage.summaryWithCache': '{total} · 缓存命中率 {percent}%',
  'message.turnUsage.model': '提供方 / 模型',
  'message.turnUsage.input': '未缓存输入',
  'message.turnUsage.cacheRead': '缓存读取',
  'message.turnUsage.cacheWrite': '缓存写入',
  'message.turnUsage.output': '输出',
  'message.turnUsage.reasoning': '（其中推理 {tokens}）',
  'message.turnUsage.total': '总计',
  'message.turnUsage.count': '{count} tok',
  'duration.seconds': '{seconds}秒',
  'duration.minutes': '{minutes}分{seconds}秒',
  'command.running': '执行中…',
  'command.failed': '指令失败',
  'command.done': '已完成',
  'command.title': '指令',
  'row.running': '运行中',
  'row.failed': '失败',
  'json.truncated': '… 已截断，共 {total} 字符',
  'clock.md': '{m}月{d}日',
  'clock.ymd': '{y}年{m}月{d}日',
} satisfies Record<string, string>

/** Chat dictionary key union. */
export type ChatKey = keyof typeof zh

/** English dictionary, checked against the Chinese key set. */
export const en = {
  'view.chat': 'Chat',
  'number.groupSeparator': ',',
  'duration.compactSeconds': '{seconds}s',
  'duration.compactMinutes': '{minutes}m{seconds}s',
  'duration.milliseconds': '{milliseconds}ms',
  'stats.counts': '{turns} turns · {steps} steps',
  'stats.llm': 'LLM {duration}',
  'stats.toolCall': 'Tool call {duration}',
  'stats.ttftAverage': 'TTFT avg {duration}',
  'stats.tokensPerSecond': '{throughput} tok/s',
  'stats.cacheHit': 'Cache hit {percent}%',
  'stats.tokens': 'Input {input} tok · Output {output} tok',
  'details.title': 'Details',
  'details.close': 'Close details',
  'details.empty': 'Click a tool row in the message flow to view its details',
  'details.notInWindow': 'This call is outside the current window',
  'details.input': 'Input',
  'details.output': 'Output',
  'details.running': 'Running…',
  'chat.loadingHistory': 'Loading history…',
  'chat.loadError': 'Failed to load history: {message} ({code})',
  'chat.loadOlder': 'Load earlier',
  'chat.toBottom': 'Back to bottom',
  'chat.deepDiving': 'Deep diving...',
  'chat.turnNavigation.label': 'Turn navigation',
  'chat.turnNavigation.jump': 'Jump to turn {turn}',
  'chat.turnNavigation.turn': 'Turn {turn}',
  'settings.transcript.title': 'Conversation display',
  'settings.transcript.description': 'Controls process content in completed turns',
  'settings.transcript.normal': 'Normal',
  'settings.transcript.compact': 'Compact',
  'fileOpen.title': 'Couldn’t open file',
  'fileOpen.unknown': 'Couldn’t open this file',
  'fileOpen.folderTitle': 'Couldn’t open folder',
  'fileOpen.folderUnknown': 'Couldn’t open this folder',
  'message.extraBlock': 'Extra content block',
  'message.systemPrompt': 'System prompt',
  'message.contextInjection': 'Context injection',
  'message.contextRecall': 'Session recall',
  'message.referenceSummary': 'Referenced session · {labels}',
  'message.referenceSeparator': ', ',
  'message.context.instructions.loaded': 'loaded',
  'message.context.instructions.added': 'added',
  'message.context.instructions.updated': 'updated',
  'message.context.instructions.removed': 'removed',
  'message.context.catalog.replaced': 'Replacement catalog',
  'message.context.catalog.more': '… {count} more',
  'message.context.snapshot.supersedes': 'Supersedes earlier snapshots',
  'message.context.relay.from': 'From session {session}',
  'message.context.recall.counts': '{retained} kept · {omitted} omitted',
  'message.context.recall.truncated': 'truncated',
  'message.compaction': 'Context compacted',
  'message.compaction.running': 'Compacting context…',
  'message.compaction.completed': 'Compacted {items} history items (~{tokens} tokens)',
  'message.compaction.expand': 'View compaction summary',
  'message.compaction.unavailable': 'Compaction summary unavailable',
  'message.compaction.commandTitle': 'compact',
  'message.think': 'Think',
  'message.unknownSurface': 'Unknown surface event: {type}',
  'message.unknownBlock': 'Unknown content block',
  'message.turnProcess.toolCalls.one': '{count} tool call',
  'message.turnProcess.toolCalls.other': '{count} tool calls',
  'message.turnProcess.messages.one': '{count} message',
  'message.turnProcess.messages.other': '{count} messages',
  'message.turnProcess.subagents.one': '{count} subagent',
  'message.turnProcess.subagents.other': '{count} subagents',
  'message.turnProcess.thoughtForAWhile': 'Thought for a while',
  'message.turnProcess.separator': ' · ',
  'message.stopped': 'Stopped',
  'message.branch': 'Branch into a new conversation',
  'message.branchUnavailable': 'Available only on the last message of a completed turn',
  'message.retry.active': 'Retrying model request',
  'message.retry.cancelled': 'Model request retry cancelled',
  'message.retry.started': 'Retried model request',
  'message.retry.scheduled': 'Waiting to retry model request',
  'message.retry.status': '{label} ({retry}/{maximum}) · {seconds}s',
  'message.retry.delay': 'Retry delay: ',
  'message.retry.failure': 'Failure reason: ',
  'message.failure.auth': 'API key is invalid',
  'message.turnError': 'This turn failed',
  'message.maxTokens': 'Output token limit reached',
  'message.maxTokens.hint': 'The reply was cut off; earlier output is preserved in the conversation. Send "continue" to let the model resume.',
  'message.ranFor': 'Ran for {duration}',
  'message.ttft': 'TTFT {seconds}s',
  'message.tokensPerSecond': '{tps} tok/s',
  'message.turnUsage.title': 'Turn usage',
  'message.turnUsage.summaryWithCache': '{total} · Cache hit {percent}%',
  'message.turnUsage.model': 'Provider / model',
  'message.turnUsage.input': 'Uncached input',
  'message.turnUsage.cacheRead': 'Cached input',
  'message.turnUsage.cacheWrite': 'Cache write',
  'message.turnUsage.output': 'Output',
  'message.turnUsage.reasoning': ' ({tokens} reasoning)',
  'message.turnUsage.total': 'Total',
  'message.turnUsage.count': '{count} tok',
  'duration.seconds': '{seconds}s',
  'duration.minutes': '{minutes}m {seconds}s',
  'command.running': 'Running…',
  'command.failed': 'Command failed',
  'command.done': 'Completed',
  'command.title': 'Command',
  'row.running': 'Running',
  'row.failed': 'Failed',
  'json.truncated': '… truncated, {total} characters total',
  'clock.md': '{m}/{d}',
  'clock.ymd': '{y}-{m}-{d}',
} satisfies Record<ChatKey, string>
