Skip to content

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

Merged
OrcaWin merged 12 commits into
mainfrom
OrcaWin/i18n-main-dialogs-27065
Oct 28, 2026
Merged

OrcaWin merged 12 commits into
mainfrom
OrcaWin/i18n-main-dialogs-27065

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​40 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​29
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​987 $\color{#cf222e}{\Huge{\mathbf{−}}}$​99 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​888

Supersedes #27065 (by @outof-place; their commits are kept, plus a merge of main and maintainer edits).

What was wrong: native dialogs from the main process (GPU safe-mode prompts, profile-state recovery/copy-choice/repair, "Saving stopped", "Orca could not start", local build switch) were always in English.

What changed

  • Original PR: those strings go through translateMain with stable keys. GPU dialog options are now built when the dialog opens, and the profile-state dialogs take translate as an injected dependency. translateMain also fills {{placeholders}} before i18n init.
  • Merged main and resolved the conflicts. Main's newer comment, imports and recovery title were kept.
  • Also localized the repair dialog that main added (chooseProfileStateRepair), including its section labels. CLI and log text that use the same labels stay in English.
  • The live-terminal count now uses liveTerminals_one / liveTerminals_other plural keys.
  • Added pt entries for every new key, and retranslated the changed recovery title.
  • Removed the test that pinned Spanish catalog strings. Kept the pre-init interpolation test (main-i18n-pre-init.test.ts).
  • Early dialogs (profile-state copy/repair/recovery, "Orca could not start", recovery-not-applied) can show before the settings store sets the language. They now first call prepareEarlyMainUiLanguage(), which uses the system language (same resolution as the "System" setting, via app.getPreferredSystemLanguages()). The persisted choice is not read there, because the store may be the thing that failed. Once a language has been set, it is kept, and normal startup still applies the user's setting. Before Electron is ready, the system language is read without being cached.
  • profile-state-startup-failure.ts prose is still in English. It is mostly CLI commands and paths, and it is also logged.

Closes #27064

outof-place and others added 5 commits October 10, 2026 03:07
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]>
…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]>
Resolve conflicts in main-i18n.ts, index.ts, profile-state-recovery-preflight.ts
and the recovery dialog test, keeping main's newer comment, imports, repair
dialog and recovery title. Locale catalogs were re-applied key by key onto main.
- Translate the profile repair dialog main added (chooseProfileStateRepair),
  including its section labels; CLI and log callers keep English labels.
- Use liveTerminals_one/_other plural keys for the local-build terminal count.
- Retranslate the recovery-not-applied title after main changed its copy.
- Add pt catalog entries for every new key.
- Keep only the pre-init interpolation test; drop the test that pinned
  Spanish catalog strings.

Co-authored-by: outof-place <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8ff6a3a4-9b48-4f68-bdcb-61c34225dd17
Commits

Reviewing files that changed from the base of the PR and between 05ebc24 and 3e9b020.

Files selected for processing: 23
  • src/main/crash-reporting/gpu-fallback-recovered-launch.ts
  • src/main/crash-reporting/gpu-fallback-restart-prompt.ts
  • src/main/i18n/main-i18n-pre-init.test.ts
  • src/main/i18n/main-i18n.ts
  • src/main/i18n/system-language.test.ts
  • src/main/i18n/system-language.ts
  • src/main/index.ts
  • src/main/local-builds/local-build-switch.ts
  • src/main/persistence/profile-state/profile-state-section-labels.ts
  • src/main/persistence/profile-state/profile-state-startup-recovery-dialog.test.ts
  • src/main/persistence/profile-state/profile-state-startup-recovery-dialog.ts
  • src/main/startup/browser-process-user-agent-ordering.test.ts
  • src/main/startup/main-process-preflight-failure.ts
  • src/main/startup/profile-state-recovery-preflight.ts
  • src/main/startup/profile-state-write-failure.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/zh.json
Walkthrough

Main-process GPU, profile-state, local-build, and startup dialogs now use translation functions with English fallback text. Fallback interpolation handles available values before i18n initialization. Early language preparation and system-language detection support dialogs shown during startup. Locale catalogs add translations in English, Spanish, French, Japanese, Korean, Portuguese, and Simplified Chinese. The English runtime-required catalog adds live-terminal reconnection messages.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Low · previous review 05ebc

Some recovery guidance may appear in English or the wrong language. Address these gaps or accept them before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description gives a detailed explanation of the problem, implementation, scope, and linked issue. However, it omits most required template sections, including Visual Proof, Testing results, AI Dis… Complete the required template sections. Add visual proof or state N/A with a reason, document manual and automated testing with platforms and results, complete applicable disclosure and review sections, confirm cross-platform and compatibi…
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: translating main-process startup and recovery dialogs.
Linked Issues check Passed Issue #27064 requires the GPU safe-graphics, profile-state, startup-failure, and local-build dialogs to follow the UI language. English text must stay unchanged. Dialogs shown before i18n init must in…
Out of Scope Changes check Passed All production and catalog changes connect to the linked issue's dialogs or to their supporting behavior.

- GPU prompt files, profile-state-section-labels.ts, `profile-state-startup-recovery-dialog…
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Full details: Linked Issues check

Explanation

Issue #27064 requires the GPU safe-graphics, profile-state, startup-failure, and local-build dialogs to follow the UI language. English text must stay unchanged. Dialogs shown before i18n init must interpolate {{placeholders}}.

Evidence at the reviewed head:

  • GPU prompts: gpuFallbackRestartOptions() and gpuFallbackRecoveredLaunchOptions() build options through translateMain with English fallbacks.
  • Profile-state dialogs: ProfileStateDialogTranslate is required in the startup-recovery, copy-choice, and repair-choice deps. Titles, messages, buttons, and section labels use translation keys with English fallbacks. profileStateSectionLabels accepts an injected translator.
  • Recovery failure and write-failure dialogs (profile-state-recovery-preflight.ts, profile-state-write-failure.ts) use translateMain.
  • Startup failure title (main-process-preflight-failure.ts) uses the translated title.
  • Local-build switch (local-build-switch.ts) uses translateMain for labels, messages, and live-terminal plural keys.
  • Pre-init interpolation: translateMain calls interpolateFallback when not initialized. Null or undefined values keep the placeholder. main-i18n-pre-init.test.ts covers this.
  • Early dialogs call prepareEarlyMainUiLanguage(), which sets the system language once and logs a warning on failure.
  • Locale catalogs (en, es, fr, ja, ko, pt, zh) contain the new keys.

Residual gap, not a named requirement: profile-state-startup-failure.ts (formatProfileStateStartupFailure) still returns English prose. The PR states this is deliberate because the text holds CLI commands and paths and is also logged. The issue does not name these strings. The summaries do not confirm whether this prose reaches a user-visible dialog. If it does, that prose stays English, and the issue expectation is only partly met for that text.

All four named dialog groups and the pre-init placeholder requirement are covered by the reviewed code.

Full details: Out of Scope Changes check

Explanation

All production and catalog changes connect to the linked issue's dialogs or to their supporting behavior.

  • GPU prompt files, profile-state-section-labels.ts, profile-state-startup-recovery-dialog.ts, main-process-preflight-failure.ts, profile-state-recovery-preflight.ts, profile-state-write-failure.ts, and local-build-switch.ts convert the named dialog strings to translateMain or injected translators.
  • main-i18n.ts (prepareEarlyMainUiLanguage, pre-init interpolation) supports the requirement that early dialogs localize and show filled placeholders.
  • system-language.ts and system-language.test.ts let the pre-ready language read return a value without caching it. prepareEarlyMainUiLanguage depends on this read.
  • src/main/index.ts passes prepareEarlyMainUiLanguage and translateMain into the profile-state dialogs.
  • en-runtime-required.json and the locale catalogs hold keys for the new strings, including the live-terminal plural keys used by the local-build dialog.
  • Tests cover the pre-init interpolation and the dialog translation injection.

The removed Spanish-catalog-pinning test is a test-only change. The author states it was removed. It does not add unrelated production behavior.

No unrelated production change is found in the summaries.

Full details: Description check

Explanation

The description gives a detailed explanation of the problem, implementation, scope, and linked issue. However, it omits most required template sections, including Visual Proof, Testing results, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist confirmations.

Resolution

Complete the required template sections. Add visual proof or state N/A with a reason, document manual and automated testing with platforms and results, complete applicable disclosure and review sections, confirm cross-platform and compatibility considerations, and check the applicable checklist items.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔇 Additional comments: 1
src/main/startup/profile-state-write-failure.ts-15-18: 1

15-18: Minor · Maintainability & Code Quality · Quick win

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Keep diagnostic log text separate from translated dialog text.

When the selected locale is not English, reportProfileStateWriteFailure logs the translated options.message and options.detail at Line 36. This makes the saving-failure log text depend on the UI language. Log a stable English message or error code, and use the translated strings only in the dialog.


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 29777090-6a0b-42d5-98f3-4be0330db7fa
Commits

Reviewing files that changed from the base of the PR and between f4d98b7 and 434f760.

Files selected for processing: 20
  • src/main/crash-reporting/gpu-fallback-recovered-launch.ts
  • src/main/crash-reporting/gpu-fallback-restart-prompt.ts
  • src/main/i18n/main-i18n-pre-init.test.ts
  • src/main/i18n/main-i18n.ts
  • src/main/index.ts
  • src/main/local-builds/local-build-switch.ts
  • src/main/persistence/profile-state/profile-state-section-labels.ts
  • src/main/persistence/profile-state/profile-state-startup-recovery-dialog.test.ts
  • src/main/persistence/profile-state/profile-state-startup-recovery-dialog.ts
  • src/main/startup/main-process-preflight-failure.ts
  • src/main/startup/profile-state-recovery-preflight.ts
  • src/main/startup/profile-state-write-failure.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/zh.json

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

Profile-state recovery, preflight failure and recovery-not-applied dialogs
can show before the settings store sets the main UI language. Resolve the
system language first so they no longer fall back to English.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4c82c8d5-15cd-4205-8d38-cc1f04387767
Commits

Reviewing files that changed from the base of the PR and between 4c0c4e5 and 05ebc24.

Files selected for processing: 14
  • src/main/i18n/main-i18n.ts
  • src/main/i18n/system-language.test.ts
  • src/main/i18n/system-language.ts
  • src/main/index.ts
  • src/main/startup/main-process-preflight-failure.ts
  • src/main/startup/profile-state-recovery-preflight.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/zh.json
Files skipped from review as they are similar to previous changes: 7
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ja.json

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

Comment thread src/main/index.ts
console.error(`[profile-state] ${message}`)
if (!state.isServeMode && !isBackgroundLaunch()) {
try {
await prepareEarlyMainUiLanguage()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Supported by static analysis

Script executed:

set -e
printf '%s\n' '--- src/main/index.ts ---'
nl -ba src/main/index.ts | sed -n '135,215p'
printf '%s\n' '--- src/main/i18n/main-i18n.ts ---'
nl -ba src/main/i18n/main-i18n.ts | sed -n '1,125p'
printf '%s\n' '--- src/main/startup/main-process-ready-foundation.ts ---'
nl -ba src/main/startup/main-process-ready-foundation.ts | sed -n '145,295p'
printf '%s\n' '--- src/main/startup/main-process-ready.ts ---'
nl -ba src/main/startup/main-process-ready.ts | sed -n '1,55p'
printf '%s\n' '--- src/main/startup/main-process-ready-runtime.ts ---'
nl -ba src/main/startup/main-process-ready-runtime.ts | sed -n '1,165p'
printf '%s\n' '--- plugin startup and language references ---'
rg -n -F --glob '*.ts' -e 'initializeMainProcessPlugins' -e 'pluginLanguagePacks' -e 'setMainUiLanguage' -e 'prepareEarlyMainUiLanguage' -e 'mainProcessI18nReady' src/main
printf '%s\n' '--- relevant diff against supplied merge base ---'
git diff --unified=35 ec49e9fac0e18ab634a41f8e6071ab2183b9d46f 05ebc24795dc3f67bd29eff3e86e98cb8d85d49d -- src/main/index.ts src/main/i18n/main-i18n.ts src/main/startup/main-process-ready.ts src/main/startup/main-process-ready-foundation.ts src/main/startup/main-process-ready-runtime.ts src/main/startup/main-process-plugins.ts

Repository: stablyai/orca

Length of output: 41932


Script executed:

set -e
printf '%s\n' '--- src/main/startup/main-process-plugins.ts ---'
nl -ba src/main/startup/main-process-plugins.ts | sed -n '1,175p'
printf '%s\n' '--- runtime initialization boundary ---'
nl -ba src/main/startup/main-process-ready-runtime.ts | sed -n '25,70p'
nl -ba src/main/startup/main-process-ready-runtime.ts | sed -n '120,150p'
printf '%s\n' '--- locale and language declarations ---'
rg -n -F --glob '*.ts' -e 'export function resolveUiLocale' -e 'export type UiLanguage' -e 'UI_LANGUAGE_SYSTEM' src/shared src/main/i18n

Repository: stablyai/orca

Length of output: 14228


Initialize the stored built-in locale before remaining startup work.

After state.store = store, add an awaited language initializer. It must load the stored built-in uiLanguage, leave plugin:* activation to the existing pack-registration path, and use the system/English fallback if loading fails.

This covers recovery dialogs after later foundation failures and runs before GPU listener installation. The recovered-launch and restart prompts can then use the stored built-in locale instead of English or the system locale.

'profileState.recoveryNotApplied.message',
'Orca could not apply the selected profile state.'
),
detail: `${response.message}\n\n${translateMain(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Translate the recovery failure reason.

response.message remains English. For example, a lock failure tells the user to stop Orca before rollback in English, while the translated guidance only says to reopen Orca. A user who cannot read the reason may repeat the failed recovery. Localize known recovery errors for the desktop dialog while preserving the CLI response and interpolating paths or commands.

# Conflicts:
#	src/renderer/src/i18n/locales/en.json
#	src/renderer/src/i18n/locales/es.json
#	src/renderer/src/i18n/locales/fr.json
#	src/renderer/src/i18n/locales/ja.json
#	src/renderer/src/i18n/locales/ko.json
#	src/renderer/src/i18n/locales/pt.json
#	src/renderer/src/i18n/locales/zh.json
@OrcaWin
OrcaWin merged commit 38a9e5c into main Oct 28, 2026
56 checks passed
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