feat(i18n): localize approval dialog surface across 7 locales#2891
feat(i18n): localize approval dialog surface across 7 locales#2891gordonlu wants to merge 2 commits into
Conversation
|
Thanks @gordonlu for taking the time to contribute. This repository is currently observing a maintainer-managed contribution gate in dry-run mode, so this pull request is staying open. When enforcement is enabled, pull requests from contributors who are not listed in Please read |
There was a problem hiding this comment.
Code Review
This pull request refactors the approval dialog in the TUI to support localization across multiple languages by defining new message IDs and translations in localization.rs and using them in ApprovalWidget. Feedback highlights a layout regression in the English translation where trailing padding spaces were removed from field labels, which breaks vertical alignment in the UI.
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.
| MessageId::ApprovalFieldAbout => "About:", | ||
| MessageId::ApprovalFieldImpact => "Impact:", | ||
| MessageId::ApprovalFieldParams => "Params:", |
There was a problem hiding this comment.
The English translations for ApprovalFieldAbout, ApprovalFieldImpact, and ApprovalFieldParams have lost their trailing padding spaces (originally "About: ", "Impact: ", and "Params: "). This causes a visual layout regression in the English approval dialog, as the description, impacts, and parameters fields will no longer align vertically.
| MessageId::ApprovalFieldAbout => "About:", | |
| MessageId::ApprovalFieldImpact => "Impact:", | |
| MessageId::ApprovalFieldParams => "Params:", | |
| MessageId::ApprovalFieldAbout => "About: ", | |
| MessageId::ApprovalFieldImpact => "Impact: ", | |
| MessageId::ApprovalFieldParams => "Params: ", |
d0756c7 to
a241654
Compare
Migrates the approval takeover card (
ApprovalWidget) from hardcoded English/ZhHans locale-match functions toMessageId-based translations covering all 7 shipped locales (En, Ja, ZhHans, ZhHant, PtBr, Es419, Vi).Changes
MessageIdvariants inlocalization.rs:ApprovalRiskReview,ApprovalRiskDestructive— risk badgesApprovalCategorySafe,ApprovalCategoryFileWrite,ApprovalCategoryShell,ApprovalCategoryNetwork,ApprovalCategoryMcpRead,ApprovalCategoryMcpAction,ApprovalCategoryUnknown— tool category labelsApprovalFieldType,ApprovalFieldAbout,ApprovalFieldImpact,ApprovalFieldParams— field labelsApprovalOptionApproveOnce,ApprovalOptionApproveAlways,ApprovalOptionDeny,ApprovalOptionAbortTurn— option labelsApprovalBlockTitle— card title wordApprovalControlsHint— footer controls hintApprovalChooseHint,ApprovalChooseAction— selection hintApprovalIntentLabel,ApprovalMoreLines— intent summary labelswidgets/mod.rs: replaced 13 locale-match functions withtr()calls; extracted color logic fromcategory_label_for()approval.rs: intent label and "more lines" hint now usetr()with named placeholder{count}Verification
cargo check -p codewhale-tui— clean, no warningscargo test -p codewhale-tui -- approval— 96/96 passcargo test -p codewhale-tui -- localization— 8/8 passshipped_first_pack_has_no_missing_core_messages— passes (no locale missing any MessageId)Greptile Summary
Replaces 13 hardcoded
locale-match functions inApprovalWidgetwithMessageId-basedtr()calls backed by 23 new message IDs covering all 7 shipped locales. The refactor also cleanly separates color logic from label text incategory_label_for(), and incidentally improvesFanoutCountswording in Japanese (待機→保留) and Brazilian Portuguese (executando→em execução).localization.rs: Adds 23MessageIdvariants with full translations across all 7 locales; all variants are registered inALL_MESSAGE_IDSand verified by theshipped_first_pack_has_no_missing_core_messagestest.widgets/mod.rs: Replaces every locale-match function withtr(locale, MessageId::…)calls;ApprovalMoreLinesuses the existing.replace(\"{count}\", …)pattern consistent withFanoutCounts..claude/settings.json: Adds a project-level Claude Code settings file granting broad shell permissions for cargo-based build and test workflows.Confidence Score: 5/5
This PR is safe to merge — it is a mechanical substitution of hardcoded strings with looked-up translations, backed by a passing exhaustive-coverage test.
Every changed line is a direct equivalence replacement: locale-match functions that returned a hardcoded string are now tr() calls that resolve to the same string through the translation table. The shipped_first_pack_has_no_missing_core_messages test guarantees no locale is missing any of the 23 new IDs, and the 96/96 approval tests confirm widget rendering is unbroken.
No files require special attention.
Important Files Changed
Reviews (2): Last reviewed commit: "fix: restore trailing spaces on English ..." | Re-trigger Greptile