Skip to content

Speak the user's language, keyed by the English the app already says - #13

Merged
PrimeBuild-pc merged 1 commit into
mainfrom
feature/multilingual-ui
Sep 2, 2026
Merged

PrimeBuild-pc merged 1 commit into
mainfrom
feature/multilingual-ui

Conversation

@PrimeBuild-pc

Copy link
Copy Markdown
Owner

The UI ships in Spanish, Russian and Simplified Chinese alongside English.

How it works

  • The key is the English source text. Loc.T("Refresh") looks up "Refresh". No catalogue of identifiers to keep in step with the screen, a translator reads sentences instead of MainWindow_Btn_Refresh, and an untranslated string degrades to readable English rather than to a resource id.
  • UiTranslator.Apply(this) walks the window after InitializeComponent — TextBlocks, content, headers, tooltips, DataGrid columns, context menus, automation names. That is what keeps the ~450 XAML strings out of the diff.
  • Loc.F($"…") uses an InterpolatedStringHandler that pulls the holes out before the lookup, so $"Diagnosing {target}…" resolves "Diagnosing {0}…" and every call site stays a normal interpolated string.
  • Assets/i18n/translations.json, embedded: 637 entries × 3 languages.
  • Language follows CurrentUICulture until Preferences says otherwise (zh-TW/zh-Hant get English, not simplified characters), and applies on the next start.

Load-bearing headers

TabItem.Header is matched as data by OpenHealthSection_Click against section names the analyzers hard-code in English. The translator parks the English original in TabItem.Tag before replacing the header, and the router now reads Tag ?? Header, so section routing survives every language.

Layout faults this surfaced

  • The System baseline label column was a fixed 150px — fits "Operating system", clips its translations. Now Auto/MinWidth.
  • App.xaml's ComboBox template renders its selection box from ItemTemplate, which DisplayMemberPath never sets, so the presenter fell through to ToString().

Verification

LocalizationTests reads the shipped XAML and fails when a string in it has no entry, checks every entry covers every language, and checks {0} placeholders survive translation. 756 tests pass. Verified on the running app in all three languages via driver.ps1.

Deliberately still English

Analyzer prose (Services/Diagnosis, Services/Remediation) — findings, recommendations, router guidance; model-supplied combo entries (DiagnosticProfiles, GameProfiles, UseCaseProfiles, TuningPreset, enums); logs and exports.

Note: driver.ps1 select finds tabs by UIA name, so a non-English run needs the translated name.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

The UI ships in Spanish, Russian and Simplified Chinese as well as English.
The translation key is the English source text, so there is no catalogue of
identifiers to keep in step with the screen, a translator reads sentences
rather than MainWindow_Btn_Refresh, and anything not yet translated degrades
to readable English instead of to a resource id.

UiTranslator walks the window after InitializeComponent, which is what keeps
the 450 XAML strings out of the diff; code sets its text through Loc.T, or
Loc.F for an interpolated string, whose handler pulls the holes out first so
"Diagnosing {0}…" is what gets looked up and the call site stays a normal
interpolated string.

Tab headers are matched as data by the health-finding router, so the English
original is parked in TabItem.Tag before the header is replaced and the
router now reads Tag ?? Header. Language follows Windows until Preferences
says otherwise, and applies on the next start.

Two layout faults surfaced only once the strings got longer: the System
baseline label column was a fixed 150px, and App.xaml's ComboBox template
renders its selection box from ItemTemplate, which DisplayMemberPath never
sets.

Analyzer prose, model-supplied combo entries, logs and exports stay English
for now.
@PrimeBuild-pc
PrimeBuild-pc merged commit 6dff45a into main Sep 2, 2026
2 checks passed
@PrimeBuild-pc
PrimeBuild-pc deleted the feature/multilingual-ui branch September 2, 2026 13:37
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.

1 participant