Skip to content

fix(desktop): System default keeps the app UI and native menus in the same language - #46060

Open
saphid wants to merge 2 commits into
pingdotgg:mainfrom
saphid:hunter/c-dea9a1ae49
Open

saphid wants to merge 2 commits into
pingdotgg:mainfrom
saphid:hunter/c-dea9a1ae49

Conversation

@saphid

@saphid saphid commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Problem

On packaged desktop with Language set to System default, the app window can stay in English while the native menus are translated. The renderer picked its catalog from navigator.languages, which the packaged Chromium pins to en-US first (see DesktopBridge.getPreferredSystemLanguages in packages/contracts/src/ipc.ts). Desktop main's applyLanguage resolves the menus from Electron's app.getPreferredSystemLanguages() instead, so the two disagree.

Deterministic repro on origin/main (95a3ec546411b62869d36a8f45ae2eaf91ddb769): run the real apps/web/src/i18n/runtime.ts (startI18n(), then await whenLocaleReady()) with saved language: "system", navigator.languages = ["en-US","fr-FR","fr","fr"], and window.desktopBridge.getPreferredSystemLanguages = () => ["fr-FR","fr"]. Only the settings store, the GT SPA initializer, and the catalog fetch are shimmed. The fetch returns the real fr.json.

  • Observed: {"rendererLocale":"en","documentLang":"","catalogEntries":0}. Desktop main's resolveLocale with the same OS list picks fr for the menus.
  • Expected: {"rendererLocale":"fr","documentLang":"fr", ...}. The window uses the same catalog as the native menus.

Change

resolveWebLocaleSelection now takes an optional OS language list and uses it for catalog selection when it is not empty. Otherwise it falls back to the browser list. The runtime passes desktopBridge.getPreferredSystemLanguages(), the list desktop main already uses. Explicit language settings, regional formatting, and browser/mobile clients that have no desktop bridge stay as they were.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • New case in apps/web/src/i18n/locales.test.ts (system follows the desktop OS languages over the pinned browser list). On base it fails with expected { catalogLocale: 'en', … } to deeply equal { catalogLocale: 'fr', … }. On head all 6 cases in the file pass.
  • Runtime transcript, base vs head, from the real runtime.ts with the inputs above. Base gives rendererLocale: "en" and head gives rendererLocale: "fr", documentLang: "fr" with the French catalog loaded: https://gist.github.com/saphid/59147b1157aba44b1e72f634fa13a6ac
  • vp run check:changed exited 0 (format, lint, knip, typecheck, tests, React Compiler).

Not shown: a run of the packaged Electron app on a non-English OS (no packaged build or localized OS in this environment); screenshots; mobile, which has no desktop bridge and is unchanged.

Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).

Not shown

  • apps/web/src/i18n/runtime.ts:67 — The transcript uses shimmed locale inputs and does not show the packaged app’s actual labels; add before/after captures of the same app label and native menu on a French-first OS when available.
  • apps/web/src/i18n/locales.test.ts:19 — The gist includes the proof harness but not the exact commands and setup for replaying it on both SHAs; add those instructions or a scenarios:prove recipe.
  • .github/pull_request_template.md:24 — The draft reports check:changed exit 0, but the linked evidence does not show the check output for af605f8a4d3f; attach the SHA and passing summary.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 30, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — System default will use OS language preferences so the desktop UI matches native menus, while retaining browser fallback. This changes the effective default language for affected desktop users and requires human review.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 87e8fa3 and 36e1e12.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Locale resolution now accepts preferred desktop system languages. The runtime passes these languages when available. Tests cover system-language selection, fallback to browser languages when the system list is empty, and preservation of an explicitly selected locale.

Changes: Locale selection

Layer / File(s) Summary
Locale resolution and runtime integration
apps/web/src/i18n/locales.ts, apps/web/src/i18n/runtime.ts, apps/web/src/i18n/locales.test.ts
resolveWebLocaleSelection uses nonempty system locales instead of browser locales. The runtime supplies preferred desktop system languages when available. Tests cover empty system-language fallback and explicit locale selection.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · previous review 87e8f

With System default, the desktop app UI now follows the OS language list used by the native menus. Explicit language settings and browsers without a desktop bridge are unchanged. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the desktop fix: with System default, the app UI and native menus should use the same language. The raw summary confirms the change makes locale resolution use the OS language list (fr…
Description check Passed The description follows the repository template in substance. It has a Problem section with expected behavior and a reproduction on origin/main. It has a Change section that explains the fix and why t…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the desktop fix: with System default, the app UI and native menus should use the same language. The raw summary confirms the change makes locale resolution use the OS language list (from desktopBridge.getPreferredSystemLanguages) when it is nonempty, which matches the main change. The title uses the conventional commit form and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the repository template in substance. It has a Problem section with expected behavior and a reproduction on origin/main. It has a Change section that explains the fix and why the runtime passes the desktop bridge list. It has a Scope section that explains why no issue is needed for this small bug fix. It has a Verification section with a focused new test, base versus head results, and a runtime transcript. It also states what was not checked: a packaged Electron run on a non-English OS and screenshots. The template asks for screenshots for UI changes, and the author explains why none are shown. The review notes flag gaps in evidence: the transcript uses shimmed inputs, the replay commands are not in the gist, and the check:changed output is not linked for the exact head SHA. These gaps weaken verification but do not make the description largely incomplete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 661a9ed and 87e8fa3.

Files selected for processing: 3

  • apps/web/src/i18n/locales.test.ts
  • apps/web/src/i18n/locales.ts
  • apps/web/src/i18n/runtime.ts

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 30, 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

size:S 10-29 changed lines (additions + deletions). takeover:in-progress A takeover lead is working on this PR vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants