Skip to content

fix(chat): translate the usage line, the full-output links and a banner's close button - #1382

Open
Zhangs-11 wants to merge 3 commits into
agegr:mainfrom
Zhangs-11:fix/message-usage-i18n
Open

Zhangs-11 wants to merge 3 commits into
agegr:mainfrom
Zhangs-11:fix/message-usage-i18n

Conversation

@Zhangs-11

@Zhangs-11 Zhangs-11 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Three places in the chat stay English with the UI set to 简体中文 or 繁體中文:

  1. The line under an assistant reply shows its token usage and the turn's duration. The duration is translated (chat.turnDuration), but the usage part is hard-coded in formatUsage() (components/MessageView.tsx), so the line reads half in each language:

    1,234 in · 567 out · 8,900 cache R · 12 cache W · $0.0036 · 耗时 12s
    
  2. Under a ! command whose output was truncated, the view full output (loading… while it loads) button and the download full output link are hard-coded (components/MessageView.tsx).

  3. The × that closes the composer's "Images may not be sent" banner has a hard-coded aria-label="Dismiss" (ModelNoticeBanner, components/ChatInput.tsx), so a screen reader reads English.

Reproduce on main

  1. Switch the UI to 简体中文.
  2. Open any session with an assistant reply that has usage: the line under it starts with 1,234 in · 567 out · ….
  3. Run !seq 1 5000 in the composer and expand its card: view full output and download full output.
  4. Select a model whose input is text only and attach an image: the banner's × is labelled Dismiss.

Fix

  • formatUsage() takes t and builds the four parts from new chat.usageInput, chat.usageOutput, chat.usageCacheRead and chat.usageCacheWrite messages, with the number as {count}. The cost part is unchanged. The Chinese labels reuse the wording of the existing session.input / session.output / session.cacheRead / session.cacheWrite labels.
  • BashExecutionView uses new chat.viewFullOutput, chat.loadingFullOutput and chat.downloadFullOutput messages.
  • ModelNoticeBanner labels its × with the existing sidebar.dismiss message (Dismiss / 关闭 / 關閉), which the sidebar toast's × already uses, so the English label stays Dismiss.

All new messages are in en, zh-CN and zh-TW, and the English strings are exactly the old ones. This is the same kind of fix as #1378 for the top bar's tooltip.

After the change, in 简体中文:

输入 1,234 · 输出 567 · 缓存读取 8,900 · 缓存写入 12 · $0.0036
查看完整输出  下载完整输出

Checks

  • npm test (2869 passed, 0 failed), node_modules/.bin/tsc --noEmit, npm run lint.
  • In headless Chrome: 简体中文 shows the lines above, and English still shows 1,234 in · 567 out · 8,900 cache R · 12 cache W · $0.0036. In a session, !seq 1 5000 shows 查看完整输出 / 下载完整输出, and clicking 查看完整输出 loads the full output from line 1. With a text-only model and an image attached, the banner's × is aria-label="关闭" and still closes the banner.
  • After the banner commit: node_modules/.bin/tsc --noEmit, components/ChatInput.test.mjs (45 passed), eslint components/ChatInput.tsx.

🤖 Generated with Claude Code

Zhangs-11 and others added 2 commits October 21, 2026 16:38
The usage line under an assistant reply ("1,234 in · 567 out · 8,900
cache R · 12 cache W") was hard-coded English, while the turn duration
next to it ("took 3s") is translated, so the Chinese UIs showed a line
half in each language. The four labels now go through chat.* messages
in en, zh-CN and zh-TW; the English text is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under a truncated ! command, the "view full output" / "loading…" button
and the "download full output" link were hard-coded English. They now go
through chat.* messages in en, zh-CN and zh-TW; the English text is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Zhangs-11 Zhangs-11 changed the title fix(chat): translate a reply's token usage line fix(chat): translate the token usage line and the full-output links Oct 21, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Zhangs-11 Zhangs-11 changed the title fix(chat): translate the token usage line and the full-output links fix(chat): translate the usage line, the full-output links and a banner's close button Oct 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant