Skip to content

feat: add localization infrastructure with .resw resource files (en-US + zh-CN) - #46

Merged
shanselman merged 1 commit into
masterfrom
feat/localization-infrastructure
Mar 17, 2026
Merged

shanselman merged 1 commit into
masterfrom
feat/localization-infrastructure

Conversation

@shanselman

Copy link
Copy Markdown
Collaborator

Add proper WinUI localization infrastructure using .resw resource files, enabling any language to be added by contributing a single resource file — no source code changes needed.

What's included

Infrastructure

  • Strings/en-us/Resources.resw — 100+ English resource entries covering all windows, dialogs, tray menu, and runtime strings
  • Strings/zh-cn/Resources.resw — Complete Chinese Simplified translations (from @Kobe9312's work in Add Chinese (Simplified) localization #30)
  • LocalizationHelper.cs — Static GetString() helper using ResourceLoader with fallback
  • x:Uid attributes on all XAML elements with user-visible text (with English fallback values)
  • DefaultLanguage set to en-US in .csproj

Localized code paths

  • SettingsWindow — all XAML labels + runtime status text (Testing.../Connected!/Failed)
  • StatusDetailWindow — headers, labels, connection status display, time formatting
  • ActivityStreamWindow — headers, filters, time-ago strings, dashboard hints
  • NotificationHistoryWindow — headers, empty state, time-ago strings
  • QuickSendDialog — title, placeholder, send button, status messages
  • WelcomeDialog / UpdateDialog — titles, body text, button labels
  • App.xaml.cs tray menu — status, sessions, nodes, activity headers, node mode states, session actions
  • Window titles — all set via LocalizationHelper

Settings persistence: safe

ComboBox values are saved/loaded by Tag attribute (from #42), not display text. Localized labels won't corrupt settings.

Review

Dual-model review (Opus + Codex). Both found resources defined but not wired up in code-behind — all fixed. Opus caught a translation error (库存提醒→股票提醒) — fixed.

Build passes, all 475 tests pass.

Adding a new language

Just create Strings/{locale}/Resources.resw with the same keys. Windows auto-selects based on OS locale.

Addresses #40
/cc @Kobe9312

@github-actions github-actions Bot mentioned this pull request Mar 17, 2026
36 tasks
Add WinUI .resw resource files for proper multi-language support:
- Strings/en-us/Resources.resw with all extractable UI strings
- Strings/zh-cn/Resources.resw with Chinese Simplified translations
- x:Uid attributes on XAML elements for automatic resource lookup
- LocalizationHelper for C# runtime string localization
- Windows auto-selects language based on OS locale

Any language can now be added by contributing a new .resw file.

Addresses #40
@shanselman
shanselman force-pushed the feat/localization-infrastructure branch from 6d6b100 to 456bd0f Compare March 17, 2026 04:44
@shanselman
shanselman merged commit afaaa04 into master Mar 17, 2026
1 check passed
@shanselman
shanselman deleted the feat/localization-infrastructure branch March 17, 2026 04:44
@Kobe9312

Copy link
Copy Markdown

Thanks @shanselman! Glad the translations from PR #30 were useful. Good catch on 库存提醒→股票提醒 — that was a mistake on my end. Looking forward to seeing the localized version ship.

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