Skip to content

fix(i18n): translate the main-process startup and recovery dialogs - #27065

Closed
outof-place wants to merge 3 commits into
stablyai:mainfrom
outof-place:i18n/main-process-dialogs
Closed

outof-place wants to merge 3 commits into
stablyai:mainfrom
outof-place:i18n/main-process-dialogs

Conversation

@outof-place

@outof-place outof-place commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

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.ts
    • profile-state-startup-recovery-dialog.ts (both dialogs), profile-state-recovery-preflight.ts, profile-state-write-failure.ts
    • main-process-preflight-failure.ts
    • local-build-switch.ts

    A 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 state translateMain() 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() and chooseProfileStateCopy() receive translate the way they already receive showMessageBox; src/main/index.ts passes translateMain. Their unit test runs in the Bun node-server suite, and a direct import would pull main-i18n, Electron's app and the renderer catalogs into that build graph, which node-server-change-scope.test.mjs forbids.

  • 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:

  • Translating only after 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.
  • Using i18next plural keys for the terminal count. Rejected: main ships an empty English resource, so English plurals would come only from fallbacks. Explicit 0 / 1 / many entries keep English exact and still read naturally in the other five catalogs.

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:

    • before init, translateMain() fills fallback placeholders and leaves unknown ones alone;
    • after switching to Spanish, the GPU restart prompt and the profile-state choice dialog (including the interpolated "Last saved" suffix) come out in Spanish.
  • 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-dialog keeps 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, and check: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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security, SSH and mobile: no impact; the change touches only native dialog strings.
  • Performance: the dialogs call translateMain() when they open; main-i18n was already in the startup graph through the menu.
  • Backwards compatibility: English copy is identical, and no IPC or persisted data changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f449767d-c301-4220-9bc5-e4d40bc4f21c

📥 Commits

Reviewing files that changed from the base of the PR and between ba6d75a and a523998.


📒 Files selected for processing (1)
  • src/main/i18n/main-i18n.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.



📝 Walkthrough

Walkthrough

Main-process graphics recovery, profile-state recovery, startup failure, and local-build dialogs now use translated text with English fallback strings. Locale catalogs add corresponding strings in English, Spanish, French, Japanese, Korean, and Simplified Chinese. Before i18n initialization, fallback text interpolates supplied values and preserves unresolved placeholders. Existing dialog choices and response handling remain unchanged.


Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to a5239

Changed dialogs use flat placeholders consistently across fallback and localized text; no merge-blocking behavior issue is indicated.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: translating main-process startup and recovery dialogs.
Description check Passed The description covers the required sections, explains the user-facing change and implementation, links issue #27064, documents testing and platform scope, and addresses checklist considerations. The …
Linked Issues check Passed Issue [#27064] requires the listed main-process dialogs to follow the selected UI language and preserve the current English copy. The changes route the GPU, profile-state, startup-failure, and local-b…
Out of Scope Changes check Passed The changes stay within issue [#27064]. The source changes localize the listed dialogs. The catalog entries, dependency injection, fallback handling, and tests support that objective. The dialog contr…

  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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]>
@outof-place
outof-place force-pushed the i18n/main-process-dialogs branch from 792d98d to fa6d779 Compare October 10, 2026 01:07
outof-place and others added 2 commits October 10, 2026 06:46
…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]>
@outof-place

Copy link
Copy Markdown
Contributor Author

Fixed the no-reflect-get lint flag.

@OrcaWin

OrcaWin commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

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.

@OrcaWin

OrcaWin commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks @outof-place — your work landed via #34608 (merged main, added pt, plurals, and early-startup language handling; co-authored). Closing as superseded.

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.

Main-process startup and recovery dialogs stay in English in every UI language

2 participants