Repository navigation
fix(i18n): translate browser cookie import failures by code - #35855
Merged
Merged
Conversation
[Medium impact] This PR appears safe to merge; no actionable issues were found. SummaryCookie import failures now carry message codes so the renderer can show translated text while keeping the existing English
OrcaWin explicitly left Reviews (1) · Last reviewed commit: "fix(i18n): translate browser cookie impo..." · Reviewed by Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cookie import refusals produced in main (file import, Chromium/Firefox/Safari import, session-profile and client-route checks) now carry a semantic
reasonCode(plusreasonParams/reasonDetailwhen the sentence interpolates values), and the renderer shows them in the UI language. The Englishreasonon the wire is byte-identical to before.What Changed
src/shared/browser-cookie-import-failure-copy.ts: one English table +browserCookieImportFailure(code, params, detail)that builds the legacy Englishreasonand the additive optionalreasonCode/reasonParams/reasonDetail.BrowserCookieImportResult's failure branch uses this type (additive only).browser-cookie-import-pipeline.ts(file import),chromium/import-cookies.ts,chromium/prepare-import.ts(browser label is a param),sources/browser-cookie-firefox-import.ts,sources/browser-cookie-safari-import.ts,ipc/browser-session-profile-ipc.ts,runtime/browser/browser-profiles.ts(runtime RPC path),browser-client-route-cookie-import.ts. The verbatim SQLite error summary goes inreasonDetail; the diag log path is a param. The now-unusedreasonWithDiagLogis removed.lib/browser-cookie-import-error-copy.ts:browserCookieImportFailureText(result)narrows withObject.hasOwn, checks each code's params, and falls back to the Englishreasonfor unknown codes, missing params, or old hosts. It is used by the four import toasts (browser toolbar menu, import hint button, settings profile row, browser-use setup step) and by the store's import error state.use-browser-page-resource-notices.ts: the cookie import success/failure banner wrapping that text is now translated (whole sentences,countplural).browser.cookieImport.*in all 11 catalogs.Left as is:
'canceled'(a sentinel, never shown), and the "This Orca client cannot report cookies skipped…" refusal (only older clients receive it, and they cannot read codes).Why
Issue #32207: main-produced English was shown verbatim in non-English UIs.
Linked Issue
Refs #32207
Visual Proof
N/A, copy/i18n only.
Testing
pnpm tcpassedpnpm testonsrc/main/browser/**cookie tests,browser-client-route-cookie-import,browser-google-cookie-clear-target, the newbrowser-cookie-import-error-copy.test.ts, and the renderer browser store/settings/browser-pane tests: all passed (existing tests that compared the whole failure object withtoEqualnow usetoMatchObject, so they still pin the Englishreason)pnpm sync:localization-runtime-catalog,verify:localization-catalogs,verify:localization-catalog,verify:localization-extraction,verify:localization-coverage,verify:localization-runtime-catalog: passedoxlinton changed files: clean;pnpm format: appliedpnpm check:changed --maxWorkers=2did not finish within 20 minutes on this loaded machine (its Electron-hosted suites time out locally), so CI is the gate