Skip to content

feat(windows): localize the Windows tray into Simplified Chinese - #1608

Open
mvanhorn wants to merge 2 commits into
getagentseal:mainfrom
mvanhorn:fix/1336-windows-tray-zh-hans
Open

mvanhorn wants to merge 2 commits into
getagentseal:mainfrom
mvanhorn:fix/1336-windows-tray-zh-hans

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Embedded en and zh-Hans catalogs, keyed by the English sentence, are resolved by one lookup used for the Rust menu and the webview. A language value of system, en, or zh-Hans is stored with the other tray settings; system follows the Windows UI language list, selecting zh-Hans for zh-Hans, zh-CN, and zh-SG and English for zh-Hant, zh-TW, zh-HK, and every other tag. Static tray and dock titles are looked up when the menu is built and rewritten in place after a settings write. The usage row stays dynamic: the webview sends the translated line plus the English original, and the row is shortened to that English line's display-cell width, with Han, kana, and Hangul counting as two cells. Placeholder fill for %@, %lld, and numbered tokens stays in Rust, and the General pane writes the language choice.

The Windows tray menu, usage row, tooltip, and settings copy stay in English even when the Windows UI language is Simplified Chinese, and tray settings offer no way to choose a language. Tray and capacity-dock titles are English literals passed into Tauri menu items, and the webview builds the usage line and tooltip in English. Tray settings have no language field, and nothing reads the Windows UI language list, so those strings never change.

Fixes #1336

Testing / Verification

  • I have tested this locally against real data (not just unit tests)
    Not done: the tray was not run on Windows.
  • npm test passes
  • npm run build succeeds
  • Not a UI change
  • UI change: before and after screenshots attached below
    This is a UI change. No screenshots are attached because the tray was not run on Windows.

The codeburn-menubar crate tests pass and clippy is clean on Rust 1.99. Windows-only code was checked by the windows-latest CI job, not locally. No JavaScript test runner executed against the webview changes.

For new providers only:

Not applicable: this PR does not add a provider.

AI was used for assistance.

Embedded en and zh-Hans catalogs, keyed by the English sentence, are
resolved by one lookup used for the Rust menu and the webview. A
language value of system, en, or zh-Hans is stored with the other tray
settings; system follows the Windows UI language list, selecting zh-Hans
for zh-Hans, zh-CN, and zh-SG and English for zh-Hant, zh-TW, zh-HK, and
every other tag. Static tray and dock titles are looked up when the menu
is built and rewritten in place after a settings write. The usage row
stays dynamic: the webview sends the translated line plus the English
original, and the row is shortened to that English line's display-cell
width, with Han, kana, and Hangul counting as two cells. Placeholder
fill for %@, %lld, and numbered tokens stays in Rust, and the General
pane writes the language choice.

Fixes getagentseal#1336
@mvanhorn
mvanhorn requested a review from iamtoruk as a code owner October 3, 2026 07:16
Clippy 1.99 rejects the non-const thread_local initializer for
FORCED_LOCALE, and on Windows placeholder_tokens is dead code outside
tests because only the catalog test calls it. The initializer is now
const and placeholder_tokens is test-only.

@iamtoruk iamtoruk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @mvanhorn, the translations are good: 24 of 29 strings match the mac zh-Hans glossary word for word, the new ones match the desktop zh-CN wording, and placeholders are kept and tested. A few things before merge:

  1. One language setting, not two. The desktop app and CLI already store the choice in ~/.config/codeburn/config.json language (zh-CN, zh-TW, …; see readConfigLanguage / setLanguage in app/electron/main.ts). With a separate language key in windows-settings.json, someone who picks 中文 in the desktop app still gets an English tray, and the two can disagree. Please have language_preference() read config.json language (zh-CN → zh-Hans, other values → en, missing → system; config.rs already reads that file), and either drop the new key and picker or have the picker write config.json.

  2. Usage row gets cut in Chinese. clamp_usage trims to the English line's display width, so "1 次调用" (8 cells vs 6) becomes "1 次调…", and Week rows lose a cell too. The mac's 24-cell budget is for the menu bar itself; the Windows usage row is a native menu item that sizes itself. Please remove clamp_usage, abbreviate, the english parameter and the cell-width helpers that only serve them.

  3. Mixed languages. In App.tsx the usage row still renders "本周 · no usage yet" and " · 1/2 devices". The mac catalog already has "%@ · no usage yet" and "%1$lld of %2$lld devices" = "%1$lld/%2$lld 台设备"; please add and format both.

  4. Small:

    • The English tooltip with a device shortfall drops the " · " after CodeBurn ("CodeBurn $4 · 1 of 2 devices reporting") while the other branch keeps "CodeBurn · $4". Please make them match.
    • FooterBar.tsx:69/74: "Settings..." and "Quit CodeBurn" (already in the catalog) aren't translated.
    • The popover and settings are still mostly English. Fine to scope this to the tray menu and tooltip, but please say so in the PR body.
    • The dock.rs tsx skip is unrelated; fine to keep, but it's out of scope.

Rust tests pass here (147/147).

@ozymandiashh ozymandiashh added enhancement New feature or request area: windows The Windows tray app and Windows-specific behaviour needs-real-data-proof PR needs screenshot or output proving it works against real data needs-validation PR requires validation against real-world usage before review labels Oct 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: windows The Windows tray app and Windows-specific behaviour enhancement New feature or request needs-real-data-proof PR needs screenshot or output proving it works against real data needs-validation PR requires validation against real-world usage before review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows tray: localization with Simplified Chinese, reusing the menubar glossary

3 participants