Repository navigation
fix(i18n): localize hosted review creation errors - #33368
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Main now tags each Orca-authored PR/MR create failure with a reason code (the English error is unchanged for mobile, older clients and logs), and the renderer maps the reason to translated copy in the Source Control notice, the Checks panel and the pre-create blocked notice. Sign-in steps are single-sourced across providers. Fixes stablyai#33321 Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
c6b438b to
a3a012c
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
ELI5
When Orca can't create a pull request or merge request (for example, you have uncommitted changes, haven't pushed, or aren't signed in), it shows an error. Until now that error was always in English, even when Orca was set to Japanese or another language. Now the host sends a short reason code with the error, and the app turns that code into a message in your language. If the host is older and sends no code, you still see the original English message.
What Changed
Before: Main built every create failure as an English sentence (
{ ok: false, code, error }) and the renderer showedresult.errorverbatim. The pre-create blocked notice (resolveBlockedCreateReviewNoticeMessage) hard-coded English templates and only localized the PR/MR label inside them. The dropdownauth_requiredhint interpolated an untranslated "Run gh auth login".After: These messages show up in the UI language in the Source Control notice, the Checks panel, the pre-create blocked notice, and the dropdown sign-in hint.
Mechanism:
CreateHostedReviewResult/CreateStackedHostedReviewResult(src/shared/hosted-review.ts) get an optionalreason(plus a trimmedbaseforbase_not_on_remote). Main sets it for every failure Orca writes itself: blocking checks,hosted-review-creation, and the GitHub/GitLab/Bitbucket/Gitea/Azure DevOps creators. The Englisherrorstays the same.src/renderer/src/components/right-sidebar/hosted-review-create-failure-copy.tsmaps each reason totranslate()copy with the provider's review label. An unknown or missing reason falls back to the host's Englisherror.resolveHostedReviewAuthInstructionis removed.sourceControl.createReviewFailure.*keys in all 7 locales (en/es/fr/ja/ko/pt/zh). Commands and env var names are left untranslated.Why
Issue #33321 (from the i18n gap list in #32207): the host built these errors as English text, so the renderer had nothing to translate. Sending a reason code alongside the English text keeps the change additive and safe across mixed versions. Older clients, mobile and logs keep reading
error. Older hosts send noreason, so newer clients fall back to the English text. A newer host's unknown reason also falls back. Translating on the host instead would tie the message to the host's locale, not the viewer's. A switch with static keys is used instead of dynamic key building because localization extraction needs literaltranslatekeys.Linked Issue
Fixes #33321
Visual Proof
N/A for screenshots: no component fixture covers these notices, and they only appear after a real create attempt fails against a hosting provider. Here is the before/after behavior from a probe with i18n set to
ja:Before (main):
After (this branch):
The probe also checked these cases:
a&b<c>comes through without HTML escaping.reasonkeeps its English detail.error.Testing
Reproduced on main with a scratch vitest (
i18n.changeLanguage('ja')+resolveBlockedCreateReviewNoticeMessage({ provider: 'github', blockedReason: 'auth_required', ... })). Main returns English and the branch returns Japanese.pnpm teston the changed test files andsrc/renderer/src/i18n: 21 files, 171 tests pass. During review,src/renderer/src/components/right-sidebar/(2531 tests) andpnpm tc:webalso passed.The
verify:localization-*catalog, extraction, coverage and runtime scripts exit 0. A script confirmed that the{{...}}placeholders and literal commands/env vars match en in every locale.oxlint, oxfmt, anti-slop oxlint, the code-quality native plugins, ast-grep, and
check-changed-code-qualityare clean on the touched files.Platforms: macOS (tests). This change only touches strings, with no platform-specific paths. SSH/remote: covered by the mixed-version fallback above, and the
hostedReview.createRPC passes the result through unchanged. Folder workspaces are unaffected (the hosted review flow applies to git repos only).I manually tested these changes locally
Automated tests added/updated, or explained why not below
Notes
ORCA_BITBUCKET_*env credentials.error.Original fix by @seijikohara in #33368.