diff --git a/components/ChatInput.tsx b/components/ChatInput.tsx index babcefe850..45a94e6944 100644 --- a/components/ChatInput.tsx +++ b/components/ChatInput.tsx @@ -565,6 +565,7 @@ function QueuedMessageRow({ kind, text }: { kind: "steer" | "follow-up"; text: s } function ModelNoticeBanner({ tone, title, body, onClose }: { tone: "error" | "warning"; title: string; body: string; onClose?: () => void }) { + const { t } = useI18n(); const color = tone === "error" ? "239,68,68" : "234,179,8"; return (
{[ - message.usage ? formatUsage(message.usage) : null, + message.usage ? formatUsage(message.usage, t) : null, turnDurationMs !== undefined ? t("chat.turnDuration", { time: formatTurnDuration(turnDurationMs) }) : null, ].filter(Boolean).join(" \u00b7 ")}
@@ -2225,17 +2225,18 @@ function formatUsage(usage: { cacheRead: number; cacheWrite: number; cost: { total: number }; -}): string { +}, t: (key: string, params?: Record) => string): string { const parts = []; - if (usage.input) parts.push(`${usage.input.toLocaleString()} in`); - if (usage.output) parts.push(`${usage.output.toLocaleString()} out`); - if (usage.cacheRead) parts.push(`${usage.cacheRead.toLocaleString()} cache R`); - if (usage.cacheWrite) parts.push(`${usage.cacheWrite.toLocaleString()} cache W`); + if (usage.input) parts.push(t("chat.usageInput", { count: usage.input.toLocaleString() })); + if (usage.output) parts.push(t("chat.usageOutput", { count: usage.output.toLocaleString() })); + if (usage.cacheRead) parts.push(t("chat.usageCacheRead", { count: usage.cacheRead.toLocaleString() })); + if (usage.cacheWrite) parts.push(t("chat.usageCacheWrite", { count: usage.cacheWrite.toLocaleString() })); if (usage.cost?.total) parts.push(`$${usage.cost.total.toFixed(4)}`); return parts.join(" · "); } function BashExecutionView({ message, sessionId }: { message: BashExecutionMessage; sessionId?: string }) { + const { t } = useI18n(); const [fullOutput, setFullOutput] = useState(null); const [loadingFull, setLoadingFull] = useState(false); const [fullError, setFullError] = useState(null); @@ -2299,14 +2300,14 @@ function BashExecutionView({ message, sessionId }: { message: BashExecutionMessa disabled={loadingFull} style={{ background: "none", border: "none", color: "var(--accent)", cursor: loadingFull ? "default" : "pointer", fontSize: 11, padding: 0, textDecoration: "underline" }} > - {loadingFull ? "loading…" : "view full output"} + {loadingFull ? t("chat.loadingFullOutput") : t("chat.viewFullOutput")} )} - download full output + {t("chat.downloadFullOutput")} {fullError && ({fullError})} diff --git a/lib/i18n/messages/en.ts b/lib/i18n/messages/en.ts index cd3d53ef39..90d0889ea9 100644 --- a/lib/i18n/messages/en.ts +++ b/lib/i18n/messages/en.ts @@ -500,6 +500,13 @@ export const enLocale: LocalePlugin = { "chat.toolCall": "tool call", "chat.toolCalls": "tool calls", "chat.turnDuration": "took {time}", + "chat.usageInput": "{count} in", + "chat.usageOutput": "{count} out", + "chat.usageCacheRead": "{count} cache R", + "chat.usageCacheWrite": "{count} cache W", + "chat.viewFullOutput": "view full output", + "chat.loadingFullOutput": "loading…", + "chat.downloadFullOutput": "download full output", "chat.collapseProcess": "Collapse process details", "chat.expandProcess": "Expand process details", "transcriptNotice.costSuffix": " (~{cost})", diff --git a/lib/i18n/messages/zh-CN.ts b/lib/i18n/messages/zh-CN.ts index bb1c64868e..7f8a6630a4 100644 --- a/lib/i18n/messages/zh-CN.ts +++ b/lib/i18n/messages/zh-CN.ts @@ -500,6 +500,13 @@ export const zhCNLocale: LocalePlugin = { "chat.toolCall": "次工具调用", "chat.toolCalls": "次工具调用", "chat.turnDuration": "耗时 {time}", + "chat.usageInput": "输入 {count}", + "chat.usageOutput": "输出 {count}", + "chat.usageCacheRead": "缓存读取 {count}", + "chat.usageCacheWrite": "缓存写入 {count}", + "chat.viewFullOutput": "查看完整输出", + "chat.loadingFullOutput": "加载中…", + "chat.downloadFullOutput": "下载完整输出", "chat.collapseProcess": "收起处理详情", "chat.expandProcess": "展开处理详情", "transcriptNotice.costSuffix": "(约 {cost})", diff --git a/lib/i18n/messages/zh-TW.ts b/lib/i18n/messages/zh-TW.ts index fe29c7f3bc..444feeba7b 100644 --- a/lib/i18n/messages/zh-TW.ts +++ b/lib/i18n/messages/zh-TW.ts @@ -500,6 +500,13 @@ export const zhTWLocale: LocalePlugin = { "chat.toolCall": "次工具呼叫", "chat.toolCalls": "次工具呼叫", "chat.turnDuration": "耗時 {time}", + "chat.usageInput": "輸入 {count}", + "chat.usageOutput": "輸出 {count}", + "chat.usageCacheRead": "快取讀取 {count}", + "chat.usageCacheWrite": "快取寫入 {count}", + "chat.viewFullOutput": "檢視完整輸出", + "chat.loadingFullOutput": "載入中…", + "chat.downloadFullOutput": "下載完整輸出", "chat.collapseProcess": "收起處理詳細資料", "chat.expandProcess": "展開處理詳細資料", "transcriptNotice.costSuffix": "(約 {cost})",