feat(i18n): localize composer surface (16 MessageIds)#2894
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 localizes the Composer widget's UI strings (including titles, placeholders, empty state headers, and submit button hints) across multiple supported languages, and pins the locale to English in PTY tests to ensure deterministic assertions. A review comment suggests avoiding heap allocations in the hot rendering path by replacing the format! call used for padding with a static space span.
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.
| Span::styled( | ||
| format!( | ||
| " {}", | ||
| self.app.tr(crate::localization::MessageId::ComposerSlashHintMove) | ||
| ), | ||
| Style::default().fg(palette::TEXT_MUTED), | ||
| ), |
There was a problem hiding this comment.
This format! call allocates a new String on every render frame. Since Renderable::render is called frequently (on every tick/input), we should avoid heap allocations in the hot path. We can achieve the same padding by adding a separate static space span Span::styled(" ", Style::default().fg(palette::TEXT_MUTED)) to the vector, which is completely zero-allocation.
Span::styled(" ", Style::default().fg(palette::TEXT_MUTED)),
Span::styled(
self.app.tr(crate::localization::MessageId::ComposerSlashHintMove),
Style::default().fg(palette::TEXT_MUTED),
),9d98bf1 to
0acba13
Compare
0acba13 to
dfc6412
Compare
Replace 16 hardcoded English strings in the composer panel with tr() calls across all 7 locales.
3943 unit + 6 PTY tests pass, 0 warnings.
Greptile Summary
Localizes 16 previously hardcoded English strings in the composer panel across all 7 supported locales by adding new
MessageIdvariants and wiringtr()calls in the widget and empty-state renderer. The PR also pins PTY tests toLANG=C, fixes a pre-existing bug wheretraditional_chinesesilently served simplified-Chinese characters forComposerPlaceholder(via theother => chinese_simplified(other)?catch-all), and adds a ZhHans no-English-leak test that covers both the slash-menu and empty-state paths.MessageIdvariants carry correct{count}/{name}/{workspace}/{version}placeholders in every locale, and the substitution call sites inwidgets/mod.rsmatch..claude/settings.jsonfile (Claude Code IDE permissions) appears to have been committed inadvertently alongside the i18n work; it should be removed from source control and added to.gitignore.Confidence Score: 5/5
The localization changes are safe to merge; the only non-localization file is an IDE settings file that should be excluded from the repo.
All format-string placeholder substitutions are consistent across locales and call sites, three pre-existing tests are correctly pinned to English, the new Chinese leak-detection test exercises both the slash-menu and empty-state paths, and PTY tests are pinned to LANG=C.
.claude/settings.json should be removed from source control rather than merged.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["tr(locale, MessageId)"] --> B{locale} B -->|En| C["english(id)"] B -->|Vi / Ja / ZhHans / PtBr / Es419| D["locale_fn(id) Option"] B -->|ZhHant| E["traditional_chinese(id)"] E -->|explicit match| F["Traditional Chinese string"] E -->|other catch-all| G["chinese_simplified(id)?"] G -->|Some| H["Simplified Chinese fallback"] G -->|None| I["fallback_translation: english(id)"] D -->|Some| J["Translated string"] D -->|None| I C --> K["Widget renders tr() result"] F --> K H --> K J --> K I --> K K --> L["ComposerWidget / build_empty_state_lines"]Reviews (3): Last reviewed commit: "feat(i18n): localize composer surface (1..." | Re-trigger Greptile