Repository navigation
fix(i18n): translate the main-process startup and recovery dialogs - #27065
outof-place wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Changed dialogs use flat placeholders consistently across fallback and localized text; no merge-blocking behavior issue is indicated. Pre-merge checks |
|
The GPU safe-graphics prompts, the profile-state recovery and write-failure
dialogs, the startup failure box and the local-build switch built their copy
from English literals, so they stayed English in every UI language. They now
read it through translateMain(), with entries in all six catalogs.
The GPU prompts built their options once at import; they now build them when
the dialog opens, so the language active at that moment applies.
Some of these dialogs can open before main i18n finishes initializing. Until
then translateMain() returned its fallback with {{placeholders}} unfilled; it
now fills them from the options, so the pre-init English copy stays correct.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
792d98d to
fa6d779
Compare
…graph
The profile-state recovery dialogs imported translateMain directly. Their unit test runs in the Bun node-server suite, so that import pulled main-i18n, Electron's app and the renderer locale catalogs into the node-server build graph. config/scripts/node-server-change-scope.test.mjs forbids renderer files there, and the Bun build also failed on the duplicate "sessionNotRestored" key the es/fr/ja/ko/zh catalogs already carry.
The dialogs now take the translator as a dependency, like showMessageBox. src/main/index.ts passes translateMain; the dialog test passes an English translator that fills the {{time}} placeholder the way translateMain does before i18n loads.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
anti-slop's no-reflect-get flags the placeholder lookup in interpolateFallback. i18next's TOptions already carries a string index signature, so a typed `options[name]` read into `unknown` replaces Reflect.get with the same behaviour. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Fixed the no-reflect-get lint flag. |
|
Thanks! I couldn't push to this branch, so I continued it in #34608, which keeps your commits. It merges main, localizes the new repair dialog, uses _one/_other plurals, adds pt, and trims the Spanish-string test. |
|
Thanks @outof-place — your work landed via #34608 (merged main, added pt, plurals, and early-startup language handling; co-authored). Closing as superseded. |
ELI5
Some pop-up dialogs that Orca's main process shows (graphics crash recovery, profile recovery, "Saving stopped", "Orca could not start", local build switching) were always in English, even when the app language is Spanish, French, Japanese, Korean or Chinese. Now they use the same translation catalogs as the rest of the app.
What Changed
Before: these dialogs built their text from English string literals in
src/main:gpu-fallback-restart-prompt.ts,gpu-fallback-recovered-launch.tsprofile-state-startup-recovery-dialog.ts(both dialogs),profile-state-recovery-preflight.ts,profile-state-write-failure.tsmain-process-preflight-failure.tslocal-build-switch.tsA user with a non-English UI saw English buttons and messages in them.
After: each string goes through
translateMain()and has an entry in all six catalogs (en,es,fr,ja,ko,zh). English output is unchanged, character for character.GPU prompts: they used to build their dialog options once, as module constants at import. They now build them when the dialog opens, so the language active at that moment applies.
translateMain()before init: some of these dialogs can open before main-process i18n finishes initializing. In that statetranslateMain()returned its fallback with{{placeholders}}left unfilled. It now fills them from the options it was given. Values it wasn't given stay as written.Profile-state dialogs take the translator as a dependency:
presentProfileStateStartupRecoveryDialog()andchooseProfileStateCopy()receivetranslatethe way they already receiveshowMessageBox;src/main/index.tspassestranslateMain. Their unit test runs in the Bun node-server suite, and a direct import would pull main-i18n, Electron'sappand the renderer catalogs into that build graph, whichnode-server-change-scope.test.mjsforbids.Text built from parts: strings that used to splice values into English (the "Last saved …" suffix, the live-terminal count, the schema version) are now separate catalog entries with placeholders. Translators get whole sentences.
Why
Orca's rule is that user-facing copy goes through the catalogs. The native menus, the tray and the renderer-recovery prompt already follow it; these dialogs were the main-process stragglers.
Alternatives considered:
ensureMainI18n(), and leaving the pre-init path alone. Rejected: the startup and profile-state dialogs are exactly the ones that can open early, and a raw{{time}}there would be a regression.Linked Issue
Fixes #27064
Visual Proof
N/A. These are native message boxes whose English text does not change. The new behaviour (copy in the selected language) is asserted by unit tests, not by screenshots: opening these dialogs needs a GPU crash loop, a damaged profile or a failed startup.
Testing
New
src/main/i18n/main-dialog-localization.test.ts:translateMain()fills fallback placeholders and leaves unknown ones alone;The existing dialog tests still pass unchanged against the English fallbacks:
gpu-fallback-restart-prompt,gpu-fallback-recovered-launch,profile-state-write-failure,profile-state-recovery-preflight,main-i18n-lazy-locale.profile-state-startup-recovery-dialogkeeps its English assertions and only passes an English translator.Passing:
pnpm tc,verify:localization-catalog(s),verify:localization-extraction,verify:localization-coverage,plain-node-entry-guard.test.ts,node-server-change-scope.test.mjs, andcheck:code-quality:changed, oxlint and oxfmt on the changed files.Platform: tested on macOS only. The change is platform-neutral (dialog strings only).
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Written with Claude Opus 5.5 (Claude Code), reviewed by me. That includes the es/fr/ja/ko/zh translations: they follow the existing catalogs' terms (perfil/profil/プロファイル/프로필/配置文件, Salir/Quitter/終了/종료/退出). Native speakers are welcome to adjust them.
Review
The non-English strings deserve a skim from a native speaker. The rest is mechanical.
Agent skill upstream boundary
Notes
translateMain()when they open; main-i18n was already in the startup graph through the menu.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code