Skip to content

i18n: localize onboard-welcome + app-mode-switch messages#2926

Open
gordonlu wants to merge 2 commits into
Hmbown:mainfrom
gordonlu:feat/i18n-misc-surfaces
Open

i18n: localize onboard-welcome + app-mode-switch messages#2926
gordonlu wants to merge 2 commits into
Hmbown:mainfrom
gordonlu:feat/i18n-misc-surfaces

Conversation

@gordonlu

@gordonlu gordonlu commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

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

  • Threaded locale parameter through welcome::lines()
  • Added StatusToastKind::ModeSwitch + StatusToast.is_mode_switch so mode-toast deduplication works regardless of locale
  • Localized /mode command output (both switched and already-in cases)
  • Pinned test ui_locale to Locale::En for deterministic assertions

Verification

  • cargo test: 4338 passed, 1 flaky (pre-existing MCP SSE test)
  • cargo clippy: clean
  • cargo fmt --all --check: clean

- 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

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines 22 to 39
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),
)),
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Issues Identified:

  1. Missing Onboarding Welcome Paragraph (OnboardWelcomeDesc3): The localized string OnboardWelcomeDesc3 is defined across all locales but is completely omitted from the welcome screen lines, resulting in a missing paragraph on the onboarding welcome screen.
  2. Unnecessary Heap Allocations: Calling .to_string() on static translation strings (which return &'static str) is inefficient. Span::styled accepts &'static str directly (as it implements Into<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>>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@gordonlu

gordonlu commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Review feedback addressed in a092187:

  1. Restored missing OnboardWelcomeDesc3 paragraph to the welcome screen.
  2. Removed unnecessary .to_string() calls.

@Hmbown

Hmbown commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Thanks @gordonlu — we merged #2891 and #2896 from your i18n batch tonight, which moved localization.rs on main, so this slice now shows as conflicting. Could you rebase it onto current main when you get a chance?

Since the slices all touch localization.rs, the smoothest path is to rebase and push them one at a time, oldest-first (#2892#2901#2918#2919#2921#2926#2929#2932#2940) — we'll merge each promptly so the next rebase stays small. Sorry for the churn; the batch is exactly the right shape and we want all of it.

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.

2 participants