i18n: localize sidebar panel labels, status messages, and focus indicators#2921
i18n: localize sidebar panel labels, status messages, and focus indicators#2921gordonlu wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Code Review
This pull request localizes various TUI sidebar strings and status messages across multiple languages. The review feedback highlights several remaining hardcoded English strings (such as 'Agents', 'turn', 'completed', and 'running') that should be localized. Additionally, the reviewer suggests pinning the locale to English in the test setup to ensure deterministic tests and simplify the assertions, rather than asserting on multiple translated variations.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| let full_texts = subagent_panel_hover_texts(&summary, &rows, usable_rows.max(1)); | ||
| let full_texts = subagent_panel_hover_texts(&summary, &rows, usable_rows.max(1), app.ui_locale); | ||
|
|
||
| render_sidebar_section(f, area, "Agents", lines, full_texts, app); |
There was a problem hiding this comment.
The panel title "Agents" is still hardcoded in English here. To ensure complete localization of the sidebar, this should be translated.
Consider adding MessageId::SidebarAgents to crates/tui/src/localization.rs and using it here.
| render_sidebar_section(f, area, "Agents", lines, full_texts, app); | |
| render_sidebar_section(f, area, tr(app.ui_locale, MessageId::SidebarAgents), lines, full_texts, app); |
There was a problem hiding this comment.
Good catch, but this is intentional — Agents is a product term (like SubAgentType kind column values). Per earlier review guidance, product terms that appear consistently across the UI (Agent, SubAgent, AgentTask) are kept in English. Users of this developer tool recognize "Agents" more readily than localized alternatives in this context.
| let label = if running == 0 { | ||
| format!("Background commands: {done} completed") | ||
| format!("{bg_label}: {done} completed") | ||
| } else if done == 0 { | ||
| format!("Background commands: {running} running") | ||
| format!("{bg_label}: {running} running") | ||
| } else { | ||
| format!("Background commands: {running} running, {done} completed") | ||
| format!("{bg_label}: {running} running, {done} completed") | ||
| }; |
There was a problem hiding this comment.
The status words "completed" and "running" are hardcoded in English, and the sentence structure {bg_label}: {running} running, {done} completed is also hardcoded.
This violates the localization goal of this PR and will result in grammatically incorrect or partially untranslated strings in other languages (e.g., Japanese or Chinese).
To properly localize this, the entire status messages should be defined as parameterized MessageIds (or the status words themselves should be translated) in crates/tui/src/localization.rs.
There was a problem hiding this comment.
These status words (running, completed) are technical status enum values consistent with the AgentStatus display pattern used elsewhere (see SubAgents PR #2899 where status values are kept English). They are the same class as done, failed, canceled — not free-form UI copy. Creating parameterized MessageIds for every {status} × {count} combination would be excessive for what is effectively debug-level status information.
| lines.push(Line::from(Span::styled( | ||
| truncate_line_to_width( | ||
| &format!("turn {turn_prefix} ({status})",), | ||
| &format!("turn {turn_prefix} ({status})"), |
There was a problem hiding this comment.
This is intentional — turn is treated as an object ID prefix (like commit abc123 or PR #456), not UI copy. The value itself (e.g. "turn_abc123") is a technical identifier. Translating it would read as unnatural as translating "commit" in a git hash display.
| text.iter() | ||
| .any(|line| line == "实时工具" || line == "Live tools"), |
There was a problem hiding this comment.
Instead of adding language-specific checks (like "实时工具") to the test assertions to prevent failures on machines with different system locales, the tests should be made deterministic by pinning the locale in the test setup.
Please update create_test_app() (around line 2437) to explicitly set app.ui_locale = Locale::En; before returning. This ensures the tests are environment-independent and allows you to simplify the assertions back to English-only.
| text.iter() | |
| .any(|line| line == "实时工具" || line == "Live tools"), | |
| text.iter() | |
| .any(|line| line == "Live tools"), |
There was a problem hiding this comment.
Fixed in amended commit — create_test_app() now pins app.ui_locale = Locale::En; and assertions simplified back to English-only.
| text.iter() | ||
| .any(|line| line == "最近工具" || line == "Recent tools"), |
There was a problem hiding this comment.
There was a problem hiding this comment.
Same as above — locale pinned in create_test_app(), assertions back to English-only.
| !text | ||
| .iter() | ||
| .any(|line| line.contains("后台命令") || line.contains("Background commands")), |
There was a problem hiding this comment.
Following the suggestion to pin app.ui_locale = Locale::En; in create_test_app(), this assertion can be simplified to only check for "Background commands".
| !text | |
| .iter() | |
| .any(|line| line.contains("后台命令") || line.contains("Background commands")), | |
| !text | |
| .iter() | |
| .any(|line| line.contains("Background commands")), |
There was a problem hiding this comment.
Same as above — locale pinned in create_test_app(), assertions back to English-only.
30daa57 to
2d9b7c2
Compare
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
… indicators Adds 17 Sidebar* MessageIds across 7 locales (En, Vi, ZhHant, Ja, ZhHans, PtBr, Es419) covering: - Section titles: Work, Tasks, Session - Panel labels: Live tools, Recent tools, Background commands, Strategy metadata - Empty states: No active work, No live tools or background jobs, No agents - Status indicator: Work state updating... - Focus/hidden status: Sidebar focus: work/tasks/agents/context/auto, Sidebar hidden Agents section title and turn prefix kept as English product terms. All locales get explicit translations (no fallback reliance). sidebar.rs create_test_app() pins Locale::En for deterministic tests.
2d9b7c2 to
28a1041
Compare
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
Thanks @gordonlu — we merged #2891 and #2896 from your i18n batch tonight, which moved Since the slices all touch |
Summary
Localizes 17 Sidebar* MessageIds across the sidebar panels, status bar focus indicators, and toggle messages.
MessageIds added
SidebarWork,SidebarTasks,SidebarSessionSidebarLiveTools,SidebarRecentTools,SidebarBackgroundCommands,SidebarStrategyMetadataSidebarNoActiveWork,SidebarNoLiveTools,SidebarNoAgentsSidebarWorkStateUpdatingSidebarFocusWork,SidebarFocusTasks,SidebarFocusAgents,SidebarFocusContext,SidebarFocusAuto,SidebarHiddenFiles changed
localization.rs: Enum entries + ALL_MESSAGE_IDS + translations for 7 localessidebar.rs: All panel labels, empty states, work state updating replaced withtr()calls;Localeparameter threaded through helper functionsui.rs: Focus status messages via keyboard shortcuts and toggle functionshotbar/actions.rs: Sidebar toggle status messages.gitignore: Exclude.claude/settings.jsonNot localized (kept English)
commit abc123)running,done, etc.) — technical enum valuesmodel,provider) — technical identifiersTesting
create_test_app()pinsLocale::Enfor deterministic testslegacy_sse_closed_stream_reconnects_and_retries_tool_callfails)cargo fmt --checkclean