Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/OpenClaw.Tray.WinUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ public App()
Logger.Warn($"[App] Ignoring invalid OPENCLAW_LANGUAGE value: {langOverride}");
}

// Wire the GatewayHostAccess localization indirection to LocalizationHelper.
// The classifier defaults to identity (returns the resource key as-is) for unit-test
// contexts that lack a WinUI runtime; in-app we point it at the real resource lookup.
GatewayHostAccessLocalization.GetString = LocalizationHelper.GetString;
GatewayHostAccessLocalization.Format = (key, args) => LocalizationHelper.Format(key, args);

InitializeComponent();

s_runMarker.Check();
Expand Down
4 changes: 2 additions & 2 deletions src/OpenClaw.Tray.WinUI/Pages/AgentEventsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,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(
Expand All @@ -106,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(
Expand Down
7 changes: 4 additions & 3 deletions src/OpenClaw.Tray.WinUI/Pages/BindingsPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/OpenClaw.Tray.WinUI/Pages/ConfigPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 6 additions & 3 deletions src/OpenClaw.Tray.WinUI/Pages/ConnectionPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,9 @@ private void ApplyGatewayHostAccess(ConnectionPagePlan plan)
return;
}

GatewayHostControlsTitleText.Text = "WSL gateway";
GatewayHostControlsDescriptionText.Text =
$"Open a shell or manage the local gateway service in {_activeHostAccessPlan.DistroName}.";
GatewayHostControlsDescriptionText.Text = LocalizationHelper.Format(
"ConnectionPage_GatewayHostControlsDescription_Format",
_activeHostAccessPlan.DistroName);
GatewayHostOpenTerminalButton.IsEnabled = !_gatewayHostActionInProgress && _activeHostAccessPlan.CanOpenTerminal;
GatewayHostStartButton.IsEnabled = !_gatewayHostActionInProgress;
GatewayHostStopButton.IsEnabled = !_gatewayHostActionInProgress;
Expand All @@ -478,6 +478,9 @@ private void ApplyGatewayHostAccess(ConnectionPagePlan plan)
? Visibility.Visible
: Visibility.Collapsed;
ToolTipService.SetToolTip(GatewayHostOpenTerminalButton, _activeHostAccessPlan.TerminalTooltip);
Microsoft.UI.Xaml.Automation.AutomationProperties.SetName(
GatewayHostOpenTerminalButton,
_activeHostAccessPlan.TerminalLabel);
}

private void SetGatewayHostActionStatus(string message, bool isError = false)
Expand Down
8 changes: 4 additions & 4 deletions src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ private void ShowJobCompletedNotification(string jobName)
_infoDismissCts = new CancellationTokenSource();
var cts = _infoDismissCts;

JobCompletedInfoBar.Title = "Job completed";
JobCompletedInfoBar.Message = $"\"{jobName}\" ran successfully and was removed.";
JobCompletedInfoBar.Title = LocalizationHelper.GetString("CronPage_JobCompleted");
JobCompletedInfoBar.Message = LocalizationHelper.Format("CronPage_JobCompletedRanSuccessfully", jobName);
JobCompletedInfoBar.IsOpen = true;
DispatcherQueue?.TryEnqueue(async () =>
{
Expand Down Expand Up @@ -863,8 +863,8 @@ private void UpdateCronLoadingVisuals()

private void ShowDisconnected()
{
ConnectionInfoBar.Title = "Gateway disconnected";
ConnectionInfoBar.Message = "Connect to a gateway to load cron jobs.";
ConnectionInfoBar.Title = LocalizationHelper.GetString("CronPage_GatewayDisconnected.Title");
ConnectionInfoBar.Message = LocalizationHelper.GetString("CronPage_GatewayDisconnected.Message");
ConnectionInfoBar.Severity = InfoBarSeverity.Warning;
ConnectionInfoBar.IsOpen = true;
}
Expand Down
10 changes: 5 additions & 5 deletions src/OpenClaw.Tray.WinUI/Pages/DebugPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,27 +150,27 @@ private void UpdateStatusInfoBar()
{
case ConnectionStatus.Connected:
StatusInfoBar.Severity = InfoBarSeverity.Success;
StatusInfoBar.Title = "Connected";
StatusInfoBar.Title = LocalizationHelper.GetConnectionStatusText(status);
StatusInfoBar.Message = $"OpenClaw is connected to {gatewayDisplay}.";
break;
case ConnectionStatus.Connecting:
StatusInfoBar.Severity = InfoBarSeverity.Informational;
StatusInfoBar.Title = "Connecting";
StatusInfoBar.Title = LocalizationHelper.GetConnectionStatusText(status);
StatusInfoBar.Message = $"Connecting to {gatewayDisplay}…";
break;
case ConnectionStatus.Disconnected:
StatusInfoBar.Severity = InfoBarSeverity.Warning;
StatusInfoBar.Title = "Disconnected";
StatusInfoBar.Title = LocalizationHelper.GetConnectionStatusText(status);
StatusInfoBar.Message = $"Not connected. Gateway: {gatewayDisplay}.";
break;
case ConnectionStatus.Error:
StatusInfoBar.Severity = InfoBarSeverity.Error;
StatusInfoBar.Title = "Connection error";
StatusInfoBar.Title = LocalizationHelper.GetConnectionStatusText(status);
StatusInfoBar.Message = $"Last gateway: {gatewayDisplay}. See the event timeline.";
break;
default:
StatusInfoBar.Severity = InfoBarSeverity.Informational;
StatusInfoBar.Title = "Status unknown";
StatusInfoBar.Title = LocalizationHelper.GetConnectionStatusText(status);
StatusInfoBar.Message = $"Gateway: {gatewayDisplay}.";
break;
}
Expand Down
5 changes: 3 additions & 2 deletions src/OpenClaw.Tray.WinUI/Pages/SessionsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using OpenClaw.Shared;
using OpenClawTray.Helpers;
using OpenClawTray.Services;
using OpenClawTray.Windows;
using System;
Expand Down Expand Up @@ -359,8 +360,8 @@ private static string FormatTokenCount(long n)

private void ShowDisconnected()
{
ConnectionInfoBar.Title = "Gateway disconnected";
ConnectionInfoBar.Message = "Connect to a gateway to load sessions.";
ConnectionInfoBar.Title = LocalizationHelper.GetString("SessionsPage_GatewayDisconnected.Title");
ConnectionInfoBar.Message = LocalizationHelper.GetString("SessionsPage_GatewayDisconnected.Message");
ConnectionInfoBar.Severity = InfoBarSeverity.Warning;
ConnectionInfoBar.IsOpen = true;
RefreshButton.IsEnabled = false;
Expand Down
9 changes: 5 additions & 4 deletions src/OpenClaw.Tray.WinUI/Pages/SkillsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using OpenClaw.Shared;
using OpenClawTray.Helpers;
using OpenClawTray.Services;
using System.Collections.Generic;
using System.ComponentModel;
Expand Down Expand Up @@ -204,12 +205,12 @@ private void RebuildCards()
foreach (var s in disabled)
DisabledPanel.Children.Add(BuildCard(s));

EnabledHeaderText.Text = $"Enabled ({enabled.Count})";
DisabledHeaderText.Text = $"Disabled ({disabled.Count})";
EnabledHeaderText.Text = LocalizationHelper.Format("SkillsPage_EnabledHeaderFormat", enabled.Count);
DisabledHeaderText.Text = LocalizationHelper.Format("SkillsPage_DisabledHeaderFormat", disabled.Count);
DisabledExpander.Visibility = disabled.Count > 0 ? Visibility.Visible : Visibility.Collapsed;

var total = _allSkills.Count;
CountText.Text = total > 0 ? $"({enabled.Count}/{total} enabled)" : "";
CountText.Text = total > 0 ? LocalizationHelper.Format("SkillsPage_CountFormat", enabled.Count, total) : "";

if (total > 0)
{
Expand Down Expand Up @@ -256,7 +257,7 @@ private Grid BuildCard(SkillData s)
};
badge.Child = new TextBlock
{
Text = s.IsEnabled ? "Enabled" : "Disabled",
Text = LocalizationHelper.GetString(s.IsEnabled ? "SkillsPage_BadgeEnabled" : "SkillsPage_BadgeDisabled"),
FontSize = 11,
FontWeight = Microsoft.UI.Text.FontWeights.SemiBold,
Foreground = (Brush)Application.Current.Resources[badgeFgKey],
Expand Down
5 changes: 3 additions & 2 deletions src/OpenClaw.Tray.WinUI/Pages/UsagePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.UI.Xaml.Controls;
using OpenClaw.Connection;
using OpenClaw.Shared;
using OpenClawTray.Helpers;
using OpenClawTray.Services;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -330,8 +331,8 @@ private void UpdateProviderLoadingVisuals()

private void ShowDisconnected()
{
ConnectionInfoBar.Title = "Gateway disconnected";
ConnectionInfoBar.Message = "Connect to a gateway to load usage data.";
ConnectionInfoBar.Title = LocalizationHelper.GetString("UsagePage_GatewayDisconnected.Title");
ConnectionInfoBar.Message = LocalizationHelper.GetString("UsagePage_GatewayDisconnected.Message");
ConnectionInfoBar.Severity = InfoBarSeverity.Warning;
ConnectionInfoBar.IsOpen = true;
}
Expand Down
30 changes: 15 additions & 15 deletions src/OpenClaw.Tray.WinUI/Services/CommandCenterStateBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal GatewayCommandCenterState Build()
{
Severity = GatewayDiagnosticSeverity.Critical,
Category = "auth",
Title = "Gateway authentication failed",
Title = LocalizationHelper.GetString("CommandCenter_AuthFailed"),
Detail = _snapshot.AuthFailureMessage
});
}
Expand All @@ -58,7 +58,7 @@ internal GatewayCommandCenterState Build()
{
Severity = GatewayDiagnosticSeverity.Warning,
Category = "pairing",
Title = "Node is waiting for approval",
Title = LocalizationHelper.GetString("CommandCenter_NodePendingApproval"),
Detail = $"Approve device {_snapshot.NodeService.ShortDeviceId} from the gateway CLI, then re-open the command center after reconnect.",
RepairAction = "Copy approval command",
CopyText = approvalCommand
Expand All @@ -71,7 +71,7 @@ internal GatewayCommandCenterState Build()
{
Severity = GatewayDiagnosticSeverity.Critical,
Category = "gateway",
Title = "Gateway connection error",
Title = LocalizationHelper.GetString("CommandCenter_GatewayConnectionError"),
Detail = "The tray is not currently connected to the gateway."
});
}
Expand All @@ -81,7 +81,7 @@ internal GatewayCommandCenterState Build()
{
Severity = GatewayDiagnosticSeverity.Warning,
Category = "gateway",
Title = "Gateway is not connected",
Title = LocalizationHelper.GetString("CommandCenter_GatewayNotConnected"),
Detail = $"Current connection state is {_snapshot.Status}."
});
}
Expand All @@ -93,7 +93,7 @@ internal GatewayCommandCenterState Build()
{
Severity = GatewayDiagnosticSeverity.Warning,
Category = "gateway",
Title = "Gateway health is stale",
Title = LocalizationHelper.GetString("CommandCenter_GatewayHealthStale"),
Detail = $"Last health check was {_snapshot.LastCheckTime:t}. Run a health check or verify the localhost tunnel."
});
}
Expand All @@ -104,7 +104,7 @@ internal GatewayCommandCenterState Build()
{
Severity = GatewayDiagnosticSeverity.Info,
Category = "channel",
Title = "No channels reported",
Title = LocalizationHelper.GetString("CommandCenter_NoChannelsReported"),
Detail = "The gateway health payload did not report any channels."
});
}
Expand All @@ -114,7 +114,7 @@ internal GatewayCommandCenterState Build()
{
Severity = GatewayDiagnosticSeverity.Info,
Category = "gateway",
Title = "Waiting for gateway health",
Title = LocalizationHelper.GetString("CommandCenter_WaitingForGatewayHealth"),
Detail = "Node mode is connected. Channel/session inventories are filled from gateway health events when available."
});
}
Expand All @@ -124,7 +124,7 @@ internal GatewayCommandCenterState Build()
{
Severity = GatewayDiagnosticSeverity.Warning,
Category = "channel",
Title = "No channels are currently running",
Title = LocalizationHelper.GetString("CommandCenter_NoChannelsRunning"),
Detail = "Channels are configured but none are reporting a running/ready state."
});
}
Expand All @@ -135,7 +135,7 @@ internal GatewayCommandCenterState Build()
{
Severity = GatewayDiagnosticSeverity.Info,
Category = "node",
Title = "No nodes reported",
Title = LocalizationHelper.GetString("CommandCenter_NoNodesReported"),
Detail = "node.list did not report any connected nodes. Pair a Windows node or verify the operator token has node inventory access."
});
}
Expand All @@ -146,7 +146,7 @@ internal GatewayCommandCenterState Build()
{
Severity = GatewayDiagnosticSeverity.Info,
Category = "usage",
Title = "Some usage costs are missing",
Title = LocalizationHelper.GetString("CommandCenter_UsageCostsMissing"),
Detail = $"{_snapshot.UsageCost.Totals.MissingCostEntries} usage entr{(_snapshot.UsageCost.Totals.MissingCostEntries == 1 ? "y is" : "ies are")} missing cost data."
});
}
Expand Down Expand Up @@ -196,7 +196,7 @@ private IEnumerable<GatewayDiagnosticWarning> BuildBrowserProxyAuthWarnings(IRea
{
Severity = GatewayDiagnosticSeverity.Info,
Category = "browser",
Title = "Browser proxy auth may need a gateway token",
Title = LocalizationHelper.GetString("CommandCenter_BrowserProxyAuthMayNeed"),
Detail = "This Windows node is advertising browser.proxy without a saved gateway shared token. QR/bootstrap pairing can connect the node, but an authenticated browser-control host may still require the same gateway token in Settings.",
RepairAction = "Copy browser proxy auth guidance",
CopyText = "If browser.proxy returns an auth error, enter the gateway shared token in Settings > Gateway Token, or configure the browser-control host to use auth compatible with the Windows node. Do not paste QR bootstrap tokens into the normal gateway token field."
Expand All @@ -218,7 +218,7 @@ private static IEnumerable<GatewayDiagnosticWarning> BuildPortDiagnosticWarnings
{
Severity = GatewayDiagnosticSeverity.Warning,
Category = "port",
Title = "SSH tunnel port is not listening",
Title = LocalizationHelper.GetString("CommandCenter_SshTunnelPortNotListening"),
Detail = port.Detail
};
}
Expand All @@ -231,7 +231,7 @@ private static IEnumerable<GatewayDiagnosticWarning> BuildPortDiagnosticWarnings
{
Severity = GatewayDiagnosticSeverity.Info,
Category = "port",
Title = "No local gateway listener detected",
Title = LocalizationHelper.GetString("CommandCenter_NoLocalGatewayListener"),
Detail = port.Detail
};
}
Expand All @@ -245,7 +245,7 @@ private static IEnumerable<GatewayDiagnosticWarning> BuildPortDiagnosticWarnings
{
Severity = GatewayDiagnosticSeverity.Info,
Category = "browser",
Title = "Browser proxy SSH forward is not listening",
Title = LocalizationHelper.GetString("CommandCenter_BrowserProxySshForwardNotListening"),
Detail = $"browser.proxy over SSH needs a companion local forward for port {port.Port}. Add the browser-control forward to the same tunnel, or enable the managed SSH tunnel so Windows starts both forwards.",
RepairAction = "Copy browser proxy SSH forward",
CopyText = BuildBrowserProxySshForwardHint(port.Port, tunnel)
Expand All @@ -257,7 +257,7 @@ private static IEnumerable<GatewayDiagnosticWarning> BuildPortDiagnosticWarnings
{
Severity = GatewayDiagnosticSeverity.Info,
Category = "browser",
Title = "Browser proxy host not detected",
Title = LocalizationHelper.GetString("CommandCenter_BrowserProxyHostNotDetected"),
Detail = "browser.proxy needs a compatible browser-control host listening on the gateway port + 2.",
RepairAction = "Copy browser setup guidance",
// string formatter — no UI
Expand Down
Loading
Loading