From c7861f3299252fa352ae1decd6040e45b9ae3a80 Mon Sep 17 00:00:00 2001 From: Regis Brid Date: Mon, 1 Jun 2026 14:04:55 -0700 Subject: [PATCH 1/3] Localize remaining English strings in tray UI Adopts the standard x:Uid + LocalizationHelper pattern for English strings that were previously hard-coded across the WinUI tray app. Pages wired with x:Uid: - AgentEventsPage, SkillsPage, SessionsPage, SandboxPage - CronPage (full form, presets, infobars, empty/loading state) - HubWindow title status text Runtime strings routed through LocalizationHelper.GetString / Format / GetConnectionStatusText: - BindingsPage, ConfigPage, CronPage, DebugPage, SessionsPage, UsagePage InfoBar titles - HubWindow.BuildCommandList (23 command palette entries + 5 toggle subtitles) - CommandCenterStateBuilder (15 warning titles) - AgentEventsPage Live/Offline status; SkillsPage badge + count formats Adds 67 new resw keys, seeded English-only across all 5 locales (en-us, fr-fr, nl-nl, zh-cn, zh-tw) using the established deferred-translation pattern. Each new key is registered in LocalizationValidationTests.InvariantOrDeferredResourceKeys so the key-parity, format-placeholder, and mojibake-detector tests pass. Validated: Tray.Tests 877/877; Shared.Tests 2045 passed / 29 skipped; localization suite 32/32. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Pages/AgentEventsPage.xaml | 4 +- .../Pages/AgentEventsPage.xaml.cs | 5 +- .../Pages/BindingsPage.xaml.cs | 7 +- .../Pages/ConfigPage.xaml.cs | 6 +- src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml | 114 ++++---- .../Pages/CronPage.xaml.cs | 17 +- .../Pages/DebugPage.xaml.cs | 10 +- .../Pages/SandboxPage.xaml | 3 +- .../Pages/SessionsPage.xaml | 11 +- .../Pages/SessionsPage.xaml.cs | 5 +- src/OpenClaw.Tray.WinUI/Pages/SkillsPage.xaml | 4 +- .../Pages/SkillsPage.xaml.cs | 9 +- .../Pages/UsagePage.xaml.cs | 5 +- .../Services/CommandCenterStateBuilder.cs | 30 +- .../Strings/en-us/Resources.resw | 263 +++++++++++++++++- .../Strings/fr-fr/Resources.resw | 263 +++++++++++++++++- .../Strings/nl-nl/Resources.resw | 263 +++++++++++++++++- .../Strings/zh-cn/Resources.resw | 263 +++++++++++++++++- .../Strings/zh-tw/Resources.resw | 263 +++++++++++++++++- .../Windows/HubWindow.xaml | 2 +- .../Windows/HubWindow.xaml.cs | 70 ++--- .../LocalizationValidationTests.cs | 94 +++++++ 22 files changed, 1556 insertions(+), 155 deletions(-) diff --git a/src/OpenClaw.Tray.WinUI/Pages/AgentEventsPage.xaml b/src/OpenClaw.Tray.WinUI/Pages/AgentEventsPage.xaml index 30062e5cf..b07e98b39 100644 --- a/src/OpenClaw.Tray.WinUI/Pages/AgentEventsPage.xaml +++ b/src/OpenClaw.Tray.WinUI/Pages/AgentEventsPage.xaml @@ -21,7 +21,7 @@ Background="#20FF4444"> - @@ -52,7 +52,7 @@ - + diff --git a/src/OpenClaw.Tray.WinUI/Pages/AgentEventsPage.xaml.cs b/src/OpenClaw.Tray.WinUI/Pages/AgentEventsPage.xaml.cs index fb0d596aa..6e967cee1 100644 --- a/src/OpenClaw.Tray.WinUI/Pages/AgentEventsPage.xaml.cs +++ b/src/OpenClaw.Tray.WinUI/Pages/AgentEventsPage.xaml.cs @@ -4,6 +4,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using OpenClaw.Shared; +using OpenClawTray.Helpers; using OpenClawTray.Services; using OpenClawTray.Windows; @@ -95,7 +96,7 @@ private void UpdateLiveBadge() { LiveDot.Fill = new Microsoft.UI.Xaml.Media.SolidColorBrush( Microsoft.UI.ColorHelper.FromArgb(255, 255, 68, 68)); - LiveText.Text = "Live"; + LiveText.Text = LocalizationHelper.GetString("AgentEventsPage_Status_Live"); LiveText.Foreground = new Microsoft.UI.Xaml.Media.SolidColorBrush( Microsoft.UI.ColorHelper.FromArgb(255, 255, 68, 68)); LiveBadge.Background = new Microsoft.UI.Xaml.Media.SolidColorBrush( @@ -105,7 +106,7 @@ private void UpdateLiveBadge() { LiveDot.Fill = new Microsoft.UI.Xaml.Media.SolidColorBrush( Microsoft.UI.ColorHelper.FromArgb(255, 128, 128, 128)); - LiveText.Text = "Offline"; + LiveText.Text = LocalizationHelper.GetString("AgentEventsPage_Status_Offline"); LiveText.Foreground = new Microsoft.UI.Xaml.Media.SolidColorBrush( Microsoft.UI.ColorHelper.FromArgb(255, 128, 128, 128)); LiveBadge.Background = new Microsoft.UI.Xaml.Media.SolidColorBrush( diff --git a/src/OpenClaw.Tray.WinUI/Pages/BindingsPage.xaml.cs b/src/OpenClaw.Tray.WinUI/Pages/BindingsPage.xaml.cs index 6f68d2b29..fcff127ec 100644 --- a/src/OpenClaw.Tray.WinUI/Pages/BindingsPage.xaml.cs +++ b/src/OpenClaw.Tray.WinUI/Pages/BindingsPage.xaml.cs @@ -1,5 +1,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using OpenClawTray.Helpers; using OpenClawTray.Services; using System; using System.Collections.Generic; @@ -153,15 +154,15 @@ private void UpdateLoadingVisuals() private void ShowDisconnected() { - ConnectionInfoBar.Title = "Gateway disconnected"; - ConnectionInfoBar.Message = "Connect to a gateway to load bindings."; + ConnectionInfoBar.Title = LocalizationHelper.GetString("BindingsPage_GatewayDisconnected.Title"); + ConnectionInfoBar.Message = LocalizationHelper.GetString("BindingsPage_GatewayDisconnected.Message"); ConnectionInfoBar.Severity = InfoBarSeverity.Warning; ConnectionInfoBar.IsOpen = true; } private void ShowLoadFailure(Exception ex) { - ConnectionInfoBar.Title = "Could not load bindings"; + ConnectionInfoBar.Title = LocalizationHelper.GetString("BindingsPage_CouldNotLoadBindings"); ConnectionInfoBar.Message = ex.Message; ConnectionInfoBar.Severity = InfoBarSeverity.Error; ConnectionInfoBar.IsOpen = true; diff --git a/src/OpenClaw.Tray.WinUI/Pages/ConfigPage.xaml.cs b/src/OpenClaw.Tray.WinUI/Pages/ConfigPage.xaml.cs index 7bfdc9755..04ccd3065 100644 --- a/src/OpenClaw.Tray.WinUI/Pages/ConfigPage.xaml.cs +++ b/src/OpenClaw.Tray.WinUI/Pages/ConfigPage.xaml.cs @@ -1133,20 +1133,20 @@ private void UpdatePermissionBanner() switch (GetConfigPermissionState()) { case ConfigPermissionState.Checking: - PermissionInfoBar.Title = "Checking config permissions"; + PermissionInfoBar.Title = LocalizationHelper.GetString("ConfigPage_CheckingConfigPermissions"); PermissionInfoBar.Message = "Waiting for the gateway to report this operator's permissions."; PermissionInfoBar.Severity = InfoBarSeverity.Informational; SetInfoBarOpen(PermissionInfoBar, true); break; case ConfigPermissionState.NoRead: ClearConfigViewForNoRead(); - PermissionInfoBar.Title = "Config unavailable"; + PermissionInfoBar.Title = LocalizationHelper.GetString("ConfigPage_ConfigUnavailable"); PermissionInfoBar.Message = "This operator token lacks operator.read permission, so the gateway config cannot be loaded here."; PermissionInfoBar.Severity = InfoBarSeverity.Error; SetInfoBarOpen(PermissionInfoBar, true); break; case ConfigPermissionState.ReadOnly: - PermissionInfoBar.Title = "Config is read-only"; + PermissionInfoBar.Title = LocalizationHelper.GetString("ConfigPage_ConfigIsReadOnly"); PermissionInfoBar.Message = "This operator token can read config but lacks operator.write permission. You can inspect and validate drafts, but Save is disabled."; PermissionInfoBar.Severity = InfoBarSeverity.Warning; SetInfoBarOpen(PermissionInfoBar, true); diff --git a/src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml b/src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml index 1e422fe25..8e0f1073e 100644 --- a/src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml +++ b/src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml @@ -26,20 +26,20 @@ - + @@ -64,13 +64,13 @@ - - -