Skip to content

fix(i18n): translate updater failure messages shown in the renderer - #35833

Merged
OrcaWin merged 3 commits into
mainfrom
OrcaWin/i18n-main-codes-21
Oct 29, 2026
Merged

OrcaWin merged 3 commits into
mainfrom
OrcaWin/i18n-main-codes-21

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​83 $\color{#cf222e}{\Huge{\mathbf{−}}}$​28 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​55
Prod 31 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​744 $\color{#cf222e}{\Huge{\mathbf{−}}}$​91 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​653

Summary

Updater failures that main sends to the renderer now carry a translation code. The update card, Settings → Updates, the Linux package recovery card and the release-channel build picker show them in the UI language.

What Changed

  • New src/shared/updater-failure-copy.ts holds one English table. updaterCodedMessage(code, params) builds the existing English message (byte-identical) and adds messageCode / messageParams.
  • Additive wire fields:
    • messageCode? / messageParams? on the UpdateStatus error variant and on ReleaseBuildListResult { ok: false }.
    • Older clients ignore them. A newer host's unknown codes and older hosts without codes fall back to the English message.
  • Converted producers:
    • Check failures (releaseNotReady, updateServerUnreachable).
    • Pinned-build refusals (channelUnsupportedPlatform, unsignedDevChannel). The channel label is a param.
    • Linux package states: marker unusable, externally managed, manual install, metadata unusable, plus recovery missing / not-regular / hash-mismatch. These reuse the existing LinuxPackageRecoveryUnavailableReason.
    • Release-list errors (repo not found, HTTP failure, unreadable list, the rate-limit variants with a plural minute count), unknown channel, invalid tag.
  • Release-list and invalid-tag errors are thrown inside main as UpdaterCodedError. Main catches them itself: the updater:listBuilds handler and the pinned-build catch copy the code onto the IPC result or status. sendErrorStatus / sendSettledCheckStatus keep the code instead of rebuilding the status from message only.
  • Renderer: src/renderer/src/lib/updater-message-copy.ts.
    • It narrows with Object.hasOwn and checks param types, and falls back to the English message. It is used by the update card error model, UpdateCard, GeneralUpdateSettingsSection and ReleaseChannelSection.
    • ReleaseChannelSection now stores the coded result instead of a string, so it re-translates on render.
    • The paired-server updater poll translates before it throws.
    • The install-instructions { ok: false } result already has reason, so the Linux recovery card maps no-sudo / no-package-manager from it.
  • The dev-channel platform list ("macOS and Windows") is part of the translated sentence instead of an English fragment.
  • 29 keys under updates.failure.* in all 10 locales.

Left as is:

  • failLinuxPackageRecovery still throws Error(message) to the invoke caller. The card shows that text for read-failed / invalid-package-path, and Electron invoke keeps only the message, so those two stay English unless the IPC returns a result object instead of throwing.
  • Other updater messages outside the listed files stay English (e.g. macOS staging, the profile-state build compatibility error, local-build errors).

Why

Main built these updater sentences in English and the renderer showed status.message verbatim, so they ignored the UI language.

Linked Issue

Refs #32207

Visual Proof

N/A — copy/i18n only.

Testing

  • pnpm sync:localization-runtime-catalog, pnpm sync:localization-catalog (filled the es/fr/pt _many forms), verify:localization-catalogs, verify:localization-catalog, verify:localization-extraction, verify:localization-coverage, verify:localization-runtime-catalog: pass
  • pnpm tc: pass
  • pnpm test on the updater main tests (updater-release-builds, updater-events, updater.check-failure, updater.prerelease-fallback, updater.publishing-window-feed, updater.build-channel-selection, updater-linux-package-recovery-actions, …), LinuxPackageInstallRecoveryCard, UpdateCard.error-card, remote-server-update-coordinator, and the new updater-message-copy.test.ts (es text for known codes, English for older hosts, unknown codes and missing params): pass
  • Existing status expectations now include messageCode. The release-builds test asserts the thrown error carries its code and params.
  • Codex review: four findings. Three fixed: the platform-list fragment, the paired-server path, and the unchecked casts (now errorMessage). The thrown recovery error is left as described above.

@OrcaWin
OrcaWin requested a review from brennanb2025 as a code owner October 29, 2026 08:09
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with one remaining non-blocking language-switch issue.

Findings

  1. P2 Recovery error keeps old language ▶

Summary

Adds translation codes to updater failures while keeping English messages for older clients.

  • Update failures show in the app’s language across update screens.
  • Linux package recovery cards translate their failure guidance.
  • Release-build errors use the app’s language in the channel picker.

Reviews (2) · Last reviewed commit: "fix(i18n): sync runtime catalog and code..." · Reviewed by Greptile

if (isCurrentRecovery()) {
setCommandUnavailable(true)
setActionError(instructions.message)
setActionError(linuxPackageCommandUnavailableText(instructions))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Recovery error keeps old language

This call saves an already translated string in actionError. After a no-sudo or no-package-manager error, changing the UI language updates the card’s other text but leaves this error in the previous language. Store the failed instructions or their reason, then call linuxPackageCommandUnavailableText during render, as the build picker does for its errors.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent 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: ee9985a1-cb65-4dfb-8880-8e794728ad51
Commits

Reviewing files that changed from the base of the PR and between 9022e30 and 97fcb05.

Files selected for processing: 3
  • src/main/updater.linux-externally-managed.test.ts
  • src/main/updater.linux-root-package-install.test.ts
  • src/renderer/src/i18n/en-runtime-required.json
Files skipped from review as they are similar to previous changes: 1
  • src/renderer/src/i18n/en-runtime-required.json

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

Walkthrough

Updater failures now use shared message codes and parameters across main-process error handling and renderer display. The renderer localizes recognized failures and uses the supplied message when a code or required parameter is unavailable. English and additional locale files add update-failure copy. Tests now check coded error fields and message localization.

Priority: Normal

Merge Risk: Minimal · up to 97fcb

No current merge-blocking risk remains; the updater catalog is consistent and passes verification.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the user-visible change, implementation, scope, rationale, visual proof, and testing. However, it uses Refs #32207 instead of the required linked issue format, and several t… Replace Refs #32207 with an actual issue link using the required Fixes #32207 format, and complete or explicitly mark as not applicable the omitted ELI5, Review, Notes, and Checklist sections. Include the required testing and review con…
Docstring Coverage Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: translating updater failure messages shown in the renderer.
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: Description check

Explanation

The description explains the user-visible change, implementation, scope, rationale, visual proof, and testing. However, it uses Refs #32207 instead of the required linked issue format, and several template sections and checklist items are omitted.

Resolution

Replace Refs #32207 with an actual issue link using the required Fixes #32207 format, and complete or explicitly mark as not applicable the omitted ELI5, Review, Notes, and Checklist sections. Include the required testing and review confirmations in the checklist.

Full details: Docstring Coverage

Explanation

Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 18 functions across 30 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 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.

Actionable comments posted: 1


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: f1dea558-2578-4e6f-a20c-c186be56fc2f
Commits

Reviewing files that changed from the base of the PR and between 6568e88 and 9022e30.

Files selected for processing: 40
  • src/main/linux-package-downloaded-status.ts
  • src/main/updater-events.test.ts
  • src/main/updater-linux-package-recovery-actions.test.ts
  • src/main/updater-release-builds.test.ts
  • src/main/updater-release-builds.ts
  • src/main/updater.build-channel-selection.test.ts
  • src/main/updater.check-failure.test.ts
  • src/main/updater.prerelease-fallback.test.ts
  • src/main/updater.publishing-window-feed.test.ts
  • src/main/updater/updater-build-selection.ts
  • src/main/updater/updater-check-failure.ts
  • src/main/updater/updater-check-state.ts
  • src/main/updater/updater-coded-error.ts
  • src/main/updater/updater-download-install.ts
  • src/main/updater/updater-install-execution.ts
  • src/main/updater/updater-package-recovery.ts
  • src/main/window/main-window-updater.ts
  • src/renderer/src/components/LinuxPackageInstallRecoveryCard.test.tsx
  • src/renderer/src/components/LinuxPackageInstallRecoveryCard.tsx
  • src/renderer/src/components/UpdateCard.tsx
  • src/renderer/src/components/maintenance/update-card/update-card-error-model.ts
  • src/renderer/src/components/settings/GeneralUpdateSettingsSection.tsx
  • src/renderer/src/components/settings/ReleaseChannelSection.tsx
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/de.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/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/updater-message-copy.test.ts
  • src/renderer/src/lib/updater-message-copy.ts
  • src/renderer/src/runtime/remote-server-updater-polling.ts
  • src/shared/update-status-types.ts
  • src/shared/updater-failure-copy.ts

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

},
"updates": {
"failure": {
"channelUnsupportedPlatform": "{{channel}} builds are produced only for {{platforms}}.",

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.

Major · Functional Correctness · Quick win

Match the English boot message to the formatter.

channelUnsupportedPlatform receives channel, but this resource also requires platforms. An English renderer uses this boot resource, so an unsupported-channel error cannot display the complete platform list. The value also disagrees with locales/en.json, which makes verify:localization-runtime-catalog fail. Replace {{platforms}} with macOS and Windows. (raw.githubusercontent.com)

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.

1 participant