Skip to content

Add Chinese (Simplified) localization#30

Closed
Kobe9312 wants to merge 2 commits intoopenclaw:masterfrom
Kobe9312:master
Closed

Add Chinese (Simplified) localization#30
Kobe9312 wants to merge 2 commits intoopenclaw:masterfrom
Kobe9312:master

Conversation

@Kobe9312
Copy link

  • Translate all UI text to Chinese
  • Add Chinese README
  • Add Chinese notification categorization docs
  • Include menu items, dialogs, and window titles

- Translate all UI text to Chinese
- Add Chinese README
- Add Chinese notification categorization docs
- Include menu items, dialogs, and window titles
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Simplified Chinese text across the WinUI tray app UI and introduces Chinese-language documentation to support Chinese-speaking users of OpenClaw Windows Hub.

Changes:

  • Translates WinUI window titles, labels, tooltips, and tray menu strings into Simplified Chinese.
  • Adds Simplified Chinese notification categorization documentation (NOTIFICATION_CATEGORIZATION_zh.md).
  • Adds a Simplified Chinese README (README_zh.md).

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/OpenClaw.Tray.WinUI/Windows/WebChatWindow.xaml Translates Web Chat window title/tooltips/error UI text.
src/OpenClaw.Tray.WinUI/Windows/StatusDetailWindow.xaml Translates status detail window UI labels/headers.
src/OpenClaw.Tray.WinUI/Windows/SettingsWindow.xaml Translates settings UI (connection/startup/notifications/advanced sections).
src/OpenClaw.Tray.WinUI/Windows/NotificationHistoryWindow.xaml Translates notification history window labels and empty state.
src/OpenClaw.Tray.WinUI/Windows/CanvasWindow.xaml Translates canvas window title and error UI.
src/OpenClaw.Tray.WinUI/Windows/ActivityStreamWindow.xaml Translates activity stream title, filter labels, empty state, footer actions.
src/OpenClaw.Tray.WinUI/Dialogs/WelcomeDialog.cs Translates welcome dialog UI strings (and some developer-facing comments/docs).
src/OpenClaw.Tray.WinUI/App.xaml.cs Translates tray popup menu item labels/headers/actions.
docs/NOTIFICATION_CATEGORIZATION_zh.md Adds Chinese documentation for notification categorization behavior and settings.
README_zh.md Adds Chinese README covering build/run/features and node mode usage.
Comments suppressed due to low confidence (3)

src/OpenClaw.Tray.WinUI/Dialogs/WelcomeDialog.cs:28

  • Inline developer comments were translated to Chinese here, but the surrounding codebase keeps implementation comments in English. For consistency and long-term maintainability, consider reverting implementation comments to English (while keeping UI strings localized).
        // 应用 Mica 背景以获得现代 Windows 11 外观
        SystemBackdrop = new MicaBackdrop();

        // 直接在窗口中构建 UI(不需要 ContentDialog)

src/OpenClaw.Tray.WinUI/Windows/StatusDetailWindow.xaml:55

  • ProviderSummaryText's fallback text was translated to "无" here, but StatusDetailWindow.xaml.cs still sets it to the hardcoded string "n/a" when usage.ProviderSummary is empty. This will reintroduce English in the translated UI; update the code-behind fallback string (or centralize localization) so the actual displayed value is localized.
                    <TextBlock Grid.Row="2" Grid.Column="0" Text="提供商:"/>
                    <TextBlock x:Name="ProviderSummaryText" Grid.Row="2" Grid.Column="1"
                               Text="无" FontWeight="SemiBold" TextWrapping="Wrap"/>

src/OpenClaw.Tray.WinUI/App.xaml.cs:873

  • These menu labels localize the surrounding text, but still display raw session values like ThinkingLevel/VerboseLevel and the toggled on/off strings (and nextVerbose is used both for display and the action payload). This produces mixed-language UI (e.g., "详细模式: off → on"). Keep the action payload values stable (on/off) but map them to localized display strings separately for the menu text.
                var currentThinking = string.IsNullOrWhiteSpace(session.ThinkingLevel) ? "off" : session.ThinkingLevel;
                var currentVerbose = string.IsNullOrWhiteSpace(session.VerboseLevel) ? "off" : session.VerboseLevel;
                var nextVerbose = string.Equals(currentVerbose, "on", StringComparison.OrdinalIgnoreCase) ? "off" : "on";
                menu.AddMenuItem(
                    $"↳ 思考模式: {currentThinking} → 高",
                    "🧠",
                    $"session-thinking|high|{session.Key}",
                    indent: true);
                menu.AddMenuItem(
                    $"↳ 详细模式: {currentVerbose} → {nextVerbose}",
                    "📝",

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

| `NotifyStock` | bool | `true` | 显示库存警报 |
| `NotifyInfo` | bool | `true` | 显示一般信息通知 |
| `NotifyChatResponses` | bool | `true` | 显示聊天响应 toasts |
| `PreferStructuredCategories` | bool | `true` | 使用网关元数据而非关键词 |
_ => "⚪"
};
menu.AddMenuItem($"Status: {_currentStatus}", statusIcon, "status");
menu.AddMenuItem($"状态: {_currentStatus}", statusIcon, "status");
Comment on lines 10 to 12
/// <summary>
/// First-run welcome dialog for new users.
/// 首次运行欢迎对话框,用于新用户。
/// </summary>
Comment on lines +59 to +62
<ComboBox x:Name="NotificationSoundComboBox" Header="声音" Width="200">
<ComboBoxItem Content="默认"/>
<ComboBoxItem Content=""/>
<ComboBoxItem Content="轻微"/>
Comment on lines +33 to 40
<TextBox x:Name="TokenTextBox" Header="令牌"
PlaceholderText="你的 API 令牌" Width="300"/>
<Button x:Name="TestConnectionButton" Content="测试"
VerticalAlignment="Bottom" Click="OnTestConnection"/>
</StackPanel>

<TextBlock x:Name="StatusLabel" Style="{StaticResource CaptionTextBlockStyle}"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
Comment on lines +21 to 24
<TextBlock x:Name="StatusText" Text="已连接"
Style="{StaticResource SubtitleTextBlockStyle}"/>
<TextBlock x:Name="LastCheckText" Text="Last check: --"
<TextBlock x:Name="LastCheckText" Text="最后检查:--"
Style="{StaticResource CaptionTextBlockStyle}"
- 🌐 **Web 聊天** - 嵌入式 WebView2 聊天窗口
- 📊 **实时状态** - 实时显示会话、频道和使用情况
- ⚡ **活动流** - 专用于实时会话、使用情况、节点和通知事件的飞出面板
- 🔔 **Toast 通知** - 带有[智能分类](docs/NOTIFICATION_CATEGORIZATION.md)的可点击 Windows 通知
@Kobe9312
Copy link
Author

Hi! I have addressed all the review comments:

  • Reverted implementation comments back to English (keeping only UI strings localized)
  • Fixed ProviderSummaryText fallback from n/a to 无 in the code-behind
  • Localized on/off display strings to 开/关 in menu items while keeping action payload values stable

Please take another look, thanks!

@shanselman
Copy link
Collaborator

@Kobe9312 — Thank you for this contribution and for taking the time to translate everything into Chinese! We genuinely appreciate the effort, and your translation work is not wasted — we want to use it.

However, after reviewing this PR carefully, we've decided we need to set up proper localization infrastructure before we can accept language-specific changes. The current approach of replacing English strings directly in source code has some fundamental issues:

  1. It makes the app Chinese-only rather than supporting both languages (or any language)
  2. Settings persistence breaks — ComboBox values like "Default"/"None"/"Subtle" are persisted to settings.json by their display text. Translating them changes what's written to disk, breaking interop with the WinForms tray
  3. Mixed language UI — enum values like ConnectionStatus.Connected still render in English via .ToString(), so you'd see "状态: Connected"
  4. No way for users to choose — the language is baked into the source, not selectable

What we're going to do instead

We're going to implement proper WinUI localization using .resw resource files (Option A / Microsoft's recommended approach):

  • Strings/en-us/Resources.resw — English (default)
  • Strings/zh-cn/Resources.resw — your Chinese translations go here
  • x:Uid attributes on XAML elements for automatic lookup
  • ResourceLoader for C# runtime strings
  • Windows automatically selects the right language based on OS locale

This means any language in the world can be added just by contributing a new .resw file — no code changes needed.

How you can help

Once we have the infrastructure PR merged (we'll file a tracking issue), we'd love your help creating the Strings/zh-cn/Resources.resw file with the translations you've already done. It'll be a much cleaner contribution — just a resource file, no source code changes.

We're going to close this PR for now, but please don't feel discouraged. We'll tag you on the localization infrastructure issue so you can jump in with the Chinese resource file as soon as it's ready.

Thank you again! 🙏

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.

4 participants