Skip to content

fix(web-shell): localize remaining hardcoded UI strings - #5189

Merged
yiliang114 merged 3 commits into
QwenLM:mainfrom
carffuca:fix/web-shell-i18n-hardcoded-strings
Jun 17, 2026
Merged

fix(web-shell): localize remaining hardcoded UI strings#5189
yiliang114 merged 3 commits into
QwenLM:mainfrom
carffuca:fix/web-shell-i18n-hardcoded-strings

Conversation

@carffuca

@carffuca carffuca commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

fix(web-shell): localize remaining hardcoded UI strings

What this PR does

Routes the remaining hardcoded English strings in the web shell through its existing localization layer and adds the matching English and Simplified Chinese entries. This covers the close-button tooltip on every dialog, the history-search bar (its label, input placeholder, and key hint), and a few icon-only buttons — the notification dismiss control, the assistant thinking-details toggle, and the sub-agent details toggle. Those icon-only buttons previously carried English-only accessibility labels, so this also improves screen-reader output. Behavior and English wording are unchanged; only previously-untranslated strings are connected to the localization layer.

Why it's needed

The web shell already ships English and Simplified Chinese and lets users switch the UI language at runtime, but these few strings were still hardcoded in English. As a result a user on Simplified Chinese still saw English close-button tooltips, an English history-search bar, and English accessibility labels. This closes those gaps using the localization mechanism that is already in place — no new infrastructure — and follows the same approach as prior localization cleanups in the project.

Reviewer Test Plan

How to verify

Start the web shell and switch the UI language to Simplified Chinese, then confirm each of the following now renders in Chinese: open any dialog and hover its close button (the tooltip reads 关闭); press Ctrl+R to open history search (the label, the input placeholder, and the key hint are all Chinese); trigger an error notification — for example by passing an invalid argument to a theme switch — and hover its dismiss button (the tooltip reads 关闭通知). Then switch the language back to English and confirm every one of those strings still renders correctly in English. The expand/collapse toggles on assistant thinking output and on sub-agent output now expose localized accessibility labels, which can be confirmed in the browser inspector.

Evidence (Before & After)

History search bar (Ctrl+R) — Simplified Chinese
search-old
search-new

Dialog close-button tooltip — Simplified Chinese
close-old
close-new

Notification dismiss tooltip — Simplified Chinese
toast-old
toast-new

Tested on

OS Status
🍏 macOS
🪟 Windows ⚠️
🐧 Linux ⚠️

Environment (optional)

Local web shell dev server (npm run dev:daemon).

Risk & Scope

  • Main risk or tradeoff: minimal — string-only changes routed through the existing localization layer, no logic changes.
  • Not validated / out of scope: English wording is unchanged (the history-search bar keeps the conventional reverse-i-search label in English). Only previously-untranslated, user-visible strings are addressed.
  • Breaking changes / migration notes: none.

Linked Issues

Closes #5186

中文说明

这个 PR 做了什么

把 web shell 中剩余的硬编码英文字符串接入现有的本地化层,并补上对应的英文和简体中文条目。涉及:每个对话框关闭按钮的悬停提示、历史搜索栏(其标签、输入占位符和按键提示),以及几个纯图标按钮——通知的关闭控件、助手「思考详情」折叠按钮、子智能体详情折叠按钮。这些纯图标按钮此前的无障碍标签只有英文,因此本次改动也改善了屏幕阅读器的输出。行为和英文措辞均保持不变,只是把此前未翻译的字符串接入本地化层。

为什么需要

web shell 已经提供英文和简体中文,并支持运行时切换界面语言,但这几个字符串仍是硬编码英文。结果是:切到简体中文的用户,仍然看到英文的关闭按钮提示、英文的历史搜索栏和英文的无障碍标签。本次改动用已经存在的本地化机制补齐这些遗漏,不引入新的基础设施,做法与项目此前的本地化清理一致。

复审测试计划

如何验证

启动 web shell,将界面语言切换为简体中文,然后确认以下各项均显示为中文:打开任一对话框并悬停其关闭按钮(提示显示「关闭」);按 Ctrl+R 打开历史搜索(标签、输入占位符、按键提示均为中文);触发一个错误通知——例如给主题切换传入一个无效参数——并悬停其关闭按钮(提示显示「关闭通知」)。随后将语言切回英文,确认上述所有字符串在英文下依然正确显示。助手思考输出和子智能体输出上的展开/收起按钮现在暴露了本地化的无障碍标签,可在浏览器审查器中确认。

证据(前后对比)

见上方英文部分的截图位置。

测试平台

macOS ✅ · Windows ⚠️(未测) · Linux ⚠️(未测)。

运行环境(可选)

本地 web shell 开发服务器(npm run dev:daemon)。

风险与范围

  • 主要风险/取舍:极小——仅字符串改动,接入现有本地化层,无逻辑改动。
  • 未验证/超出范围:英文措辞保持不变(历史搜索栏在英文下仍保留惯用的 reverse-i-search 标签)。仅处理此前未翻译的、用户可见的字符串。
  • 破坏性变更/迁移说明:无。

关联 Issue

Closes #5186

@wenshao wenshao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] Two dialogs were missed in the dialog.close migration: ModelDialog.tsx:191 and ToolsDialog.tsx:130 still use t('common.close') (lowercase "close"), while the 9 other dialogs now use t('dialog.close') (uppercase "Close"). This creates an inconsistent tooltip across dialogs. Consider migrating these two files to dialog.close as well, or reusing common.close everywhere to avoid key duplication.

— qwen3.7-max via Qwen Code /review

Comment thread packages/web-shell/client/components/ToastHost.tsx
Comment thread packages/web-shell/client/i18n.tsx Outdated
Route the last few hardcoded English strings in web-shell through the
existing useI18n()/t() layer and add matching en / zh-CN keys:

- close-button tooltips across 9 dialogs
- the history-search label, placeholder and key hint in the editor
- icon-button aria-labels (toast dismiss, thinking toggle, sub-agent
  stream toggle), which also improves screen-reader support

No new i18n infrastructure; follows the existing pattern used by the
same components.
@carffuca
carffuca force-pushed the fix/web-shell-i18n-hardcoded-strings branch from f01419f to ecdeb7d Compare June 16, 2026 10:38
@carffuca

Copy link
Copy Markdown
Collaborator Author

Thanks for the review @wenshao — both suggestions applied:

  1. Dialog close consistency: dropped the new dialog.close key and migrated the 9 dialogs to the existing t('common.close'). All 11 dialogs (including ModelDialog and ToolsDialog) now share the same key — consistent tooltip, no key duplication.

  2. Toast dismiss split: kept toast.dismiss ("Dismiss notification" / "关闭通知") for the screen-reader aria-label, and added a separate toast.dismissShort ("Dismiss" / "关闭") for the title hover tooltip — so the tooltip stays concise and the English wording is unchanged from before.

Pushed (force-update on the same branch). PTAL.

Resolve conflict in AssistantMessage.tsx: upstream independently
localized the thinking-toggle button using thinking.expand /
thinking.collapse keys (plus title attributes). Adopt upstream's
version wholesale and drop our now-redundant assistant.toggleThinking
key (en + zh) from i18n.tsx.

Remaining web-shell i18n work (dialog close buttons, editor history
search, toast dismiss, sub-agent stream toggle) is unaffected.

@ytahdn ytahdn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found. LGTM! ✅

— qwen3.7-max via Qwen Code /review

@yiliang114 yiliang114 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. I re-checked the current head and the localization changes are scoped to the remaining web-shell UI strings, with the earlier consistency comments addressed. No blockers from my side.

@yiliang114
yiliang114 enabled auto-merge (squash) June 17, 2026 03:41
@yiliang114
yiliang114 merged commit 6fbcf80 into QwenLM:main Jun 17, 2026
13 checks passed
@carffuca
carffuca deleted the fix/web-shell-i18n-hardcoded-strings branch June 17, 2026 06:28
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.

Localize remaining hardcoded English UI strings in web-shell

5 participants