Conversation
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
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
left a comment
There was a problem hiding this comment.
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:
-
One language setting, not two. The desktop app and CLI already store the choice in
~/.config/codeburn/config.jsonlanguage(zh-CN,zh-TW, …; seereadConfigLanguage/setLanguagein app/electron/main.ts). With a separatelanguagekey in windows-settings.json, someone who picks 中文 in the desktop app still gets an English tray, and the two can disagree. Please havelanguage_preference()read config.jsonlanguage(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. -
Usage row gets cut in Chinese.
clamp_usagetrims 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 removeclamp_usage,abbreviate, theenglishparameter and the cell-width helpers that only serve them. -
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. -
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).
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
Not done: the tray was not run on Windows.
npm testpassesnpm run buildsucceedsThis 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.