i18n: localize onboard-welcome + app-mode-switch messages#2926
i18n: localize onboard-welcome + app-mode-switch messages#2926gordonlu wants to merge 2 commits into
Conversation
- Add 10 MessageIds for OnboardWelcome (6) and AppMode (4) surfaces - Thread locale into welcome::lines() and use tr() for all text - Add StatusToastKind + is_mode_switch so mode-toast dedup works regardless of locale - Localize /mode command output via AppModeSwitched/AppModeAlreadyIn - Pin test locale to Locale::En for deterministic assertions
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 the onboarding welcome screen and app mode status messages across multiple languages. It also refactors the status toast deduplication logic to use a locale-independent StatusToastKind enum instead of relying on English string matching. The review feedback highlights that the third onboarding description paragraph (OnboardWelcomeDesc3) was accidentally omitted from the welcome screen, and suggests avoiding unnecessary heap allocations by removing .to_string() calls on static translation strings.
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.
| Line::from(Span::styled( | ||
| "A focused terminal workspace for longer model sessions.", | ||
| tr(locale, MessageId::OnboardWelcomeDesc).to_string(), | ||
| Style::default().fg(palette::TEXT_PRIMARY), | ||
| )), | ||
| Line::from(Span::styled( | ||
| "You'll add an API key, review trust for this directory, and then land in the chat.", | ||
| Style::default().fg(palette::TEXT_MUTED), | ||
| )), | ||
| Line::from(Span::styled( | ||
| "The main composer is multi-line, so you can write full prompts instead of squeezing everything into one line.", | ||
| tr(locale, MessageId::OnboardWelcomeDesc2).to_string(), | ||
| Style::default().fg(palette::TEXT_MUTED), | ||
| )), | ||
| Line::from(""), | ||
| Line::from(Span::styled( | ||
| "Press Enter to continue.", | ||
| tr(locale, MessageId::OnboardWelcomeEnter).to_string(), | ||
| Style::default().fg(palette::TEXT_PRIMARY), | ||
| )), | ||
| Line::from(Span::styled( | ||
| "Ctrl+C exits at any point.", | ||
| tr(locale, MessageId::OnboardWelcomeExit).to_string(), | ||
| Style::default().fg(palette::TEXT_MUTED), | ||
| )), | ||
| ] |
There was a problem hiding this comment.
Issues Identified:
- Missing Onboarding Welcome Paragraph (
OnboardWelcomeDesc3): The localized stringOnboardWelcomeDesc3is defined across all locales but is completely omitted from the welcome screen lines, resulting in a missing paragraph on the onboarding welcome screen. - Unnecessary Heap Allocations: Calling
.to_string()on static translation strings (which return&'static str) is inefficient.Span::styledaccepts&'static strdirectly (as it implementsInto<Cow<'static, str>>), allowing you to avoid runtime heap allocations for these static strings.
The suggested change restores the missing description paragraph and removes the unnecessary .to_string() allocations.
Line::from(Span::styled(
tr(locale, MessageId::OnboardWelcomeDesc),
Style::default().fg(palette::TEXT_PRIMARY),
)),
Line::from(Span::styled(
tr(locale, MessageId::OnboardWelcomeDesc2),
Style::default().fg(palette::TEXT_MUTED),
)),
Line::from(Span::styled(
tr(locale, MessageId::OnboardWelcomeDesc3),
Style::default().fg(palette::TEXT_MUTED),
)),
Line::from(""),
Line::from(Span::styled(
tr(locale, MessageId::OnboardWelcomeEnter),
Style::default().fg(palette::TEXT_PRIMARY),
)),
Line::from(Span::styled(
tr(locale, MessageId::OnboardWelcomeExit),
Style::default().fg(palette::TEXT_MUTED),
)),
]… calls - Restore the third description paragraph that was accidentally omitted from the welcome screen output - Remove .to_string() on tr() results; Span::styled accepts &'static str directly via Into<Cow<'static, str>>
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.
|
Review feedback addressed in a092187:
|
|
Thanks @gordonlu — we merged #2891 and #2896 from your i18n batch tonight, which moved Since the slices all touch |
Summary
Localize two pure-UI surfaces, OnboardWelcome (6 MessageIds) and AppMode (4 MessageIds), across all 7 shipped locales.
OnboardWelcome
OnboardWelcomeVersion—"Version {version}"OnboardWelcomeDesc—"A focused terminal workspace for longer model sessions."OnboardWelcomeDesc2—"You'll add an API key, review trust for this directory, and then land in the chat."OnboardWelcomeDesc3—"The main composer is multi-line, so you can write full prompts..."OnboardWelcomeEnter—"Press Enter to continue."OnboardWelcomeExit—"Ctrl+C exits at any point."AppMode
AppModeSwitched—"Switched to {mode} mode"AppModeAlreadyIn—"Already in {mode} mode"Infrastructure
localeparameter throughwelcome::lines()StatusToastKind::ModeSwitch+StatusToast.is_mode_switchso mode-toast deduplication works regardless of locale/modecommand output (both switched and already-in cases)ui_localetoLocale::Enfor deterministic assertionsVerification
cargo test: 4338 passed, 1 flaky (pre-existing MCP SSE test)cargo clippy: cleancargo fmt --all --check: clean