Repository navigation
Decouple feature copy from locale parity - #8512
Conversation
|
Warning Review limit reached
Next review available in: 11 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR adds i18next extraction configuration and verification, integrates extraction checks into package scripts and the PR workflow, and adds tests for extraction diagnostics. Locale catalog verification now reports parity issues without repairing target catalogs, while documentation and package contract tests reflect the revised process. Runtime localization tests cover caller-provided fallbacks for missing entries, and several UI translation keys, interpolation calls, placeholders, labels, and English catalog entries are updated. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
src/renderer/src/components/native-chat/NativeChatToolRun.tsx (1)
110-115: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueManual singular/plural split instead of i18next plural forms.
Using two hardcoded keys (
countOne/countN) instead of i18next'scount-based plural suffixes works for English but can't represent plural rules for locales with more than two forms (e.g. Russian, Arabic, Polish). Since this repo already lazy-loads non-English catalogs via i18next, consider switching tot('components.native-chat.tool.count', { count: callCount })withcount_one/count_otherkeys for future-proofing.src/renderer/src/components/stats/UsageBreakdownSection.tsx (1)
51-53: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConcatenating separately-translated fragments locks word order across locales.
{row.sessions} {translate('sessions •')} {row.eventsOrTurns} {eventsOrTurnsLabel}stitches three independently translated pieces together in a fixed English order. Non-English locales can't reorder count/unit/label without changing the concatenation logic in code, since each fragment is translated (and interpolated) separately. Consider a single template string with{{value0}}/{{value1}}placeholders instead so translators can control ordering.♻️ Proposed single-template approach
- <div className="text-xs text-muted-foreground"> - {row.sessions}{' '} - {translate('auto.components.stats.UsageBreakdownSection.02a046792e', 'sessions •')}{' '} - {row.eventsOrTurns} {eventsOrTurnsLabel} + <div className="text-xs text-muted-foreground"> + {translate( + 'auto.components.stats.UsageBreakdownSection.sessionsSummary', + '{{value0}} sessions • {{value1}} {{value2}}', + { value0: row.sessions, value1: row.eventsOrTurns, value2: eventsOrTurnsLabel } + )}config/scripts/verify-localization-extraction.mjs (1)
83-96: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winAdd a timeout to
execFileAsync. The extraction step can hang indefinitely ifi18next-clistalls; the--sync-primaryrun already targets the configured temp output path, so it won’t touch the committedsrc/renderer/src/i18n/locales/en.json.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: fef184ce-460f-4263-80d0-42d2541d9702
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (18)
.github/CODEOWNERS.github/workflows/pr.ymlconfig/localization-audit.mdconfig/scripts/localization-package-contract.test.mjsconfig/scripts/verify-localization-catalog.mjsconfig/scripts/verify-localization-catalog.test.mjsconfig/scripts/verify-localization-extraction.mjsconfig/scripts/verify-localization-extraction.test.mjsi18next.config.tspackage.jsonsrc/main/i18n/main-i18n-lazy-locale.test.tssrc/renderer/src/components/native-chat/NativeChatToolRun.tsxsrc/renderer/src/components/right-sidebar/use-hosted-review-actions.tssrc/renderer/src/components/settings/shortcuts-search.tssrc/renderer/src/components/sidebar/AddRepoCloneStep.tsxsrc/renderer/src/components/stats/UsageBreakdownSection.tsxsrc/renderer/src/i18n/lazy-locale.test.tssrc/renderer/src/i18n/locales/en.json
…alog-decoupling # Conflicts: # .github/workflows/pr.yml # package.json # pnpm-lock.yaml
| @@ -380,7 +313,7 @@ function verifyLocaleParity(enCatalog, localeName, localeCatalog) { | |||
| return 1 | |||
| } | |||
There was a problem hiding this comment.
Extra-key failures are now unresolvable by
sync:localization-catalog
verifyLocaleCatalog still fails CI when a target catalog contains a key that no longer exists in en.json (extraInLocale). But repairLocaleParity was removed, so sync:localization-catalog --fix no longer removes those orphaned entries. A developer who deletes an English key will now face a CI failure that cannot be fixed with the sync script — they need to either edit target catalogs directly or file a localization PR. Consider adding a note to localization-audit.md explaining that deleting an English key requires a corresponding target-catalog cleanup PR.
| await execFileAsync(process.execPath, [cliPath, 'extract', '--sync-primary', '--quiet'], { | ||
| cwd: root, | ||
| env: { | ||
| ...process.env, | ||
| ORCA_I18N_EXTRACTION_OUTPUT: outputPattern.split(path.sep).join('/') | ||
| } | ||
| }) |
There was a problem hiding this comment.
--sync-primary with a redirected output path — verify write destination
The command passes ORCA_I18N_EXTRACTION_OUTPUT pointing at tempDir, and i18next.config.ts uses that env var as the output pattern. However, --sync-primary in some i18next-cli versions writes the primary locale back to a hard-coded path rather than the configured output value. If the CLI writes an updated en.json to src/renderer/src/i18n/locales/en.json instead of tempDir/en.json, the concurrent fs.readFile of en.json in Promise.all races with the write, and the source tree gets modified unexpectedly in CI. A git diff --exit-code step after the extraction job would make the isolation assumption explicit and detectable.
Greptile SummaryThis PR decouples feature copy from locale parity by allowing target catalogs to be sparse: missing translations fall through to i18next's existing English fallback rather than failing CI. A new
Confidence Score: 5/5Safe to merge — the catalog verifier correctly narrows its failure conditions, the extraction runs in a fully isolated temp directory, existing target translations are untouched byte-for-byte, and the English fallback path is exercised by two explicit new tests. All behavioral changes are deliberate and well-tested: the new sparse-catalog contract is covered by updated catalog tests, the extraction comparator is covered by unit tests, and the renderer/main fallback behavior has direct test coverage. The component refactors are mechanically correct and the new en.json entries match the interpolation variables used at the call sites. Files Needing Attention: No files require special attention. The localization scripts are the most structurally significant change, and they have good test coverage for the key logic paths.
|
| Filename | Overview |
|---|---|
| config/scripts/verify-localization-extraction.mjs | New extraction verifier: runs i18next-cli to a temp dir, compares extracted keys against en.json, and fails only on undeclared keys or incompatible placeholders; drift and orphans are report-only. |
| config/scripts/verify-localization-catalog.mjs | Replaced verifyLocaleParity (failing on missing keys) with verifyLocaleCatalog (logging missing, failing only on extraInLocale/interpolationMismatches); removed repairLocaleParity and deleteCatalogEntry. |
| config/scripts/localization-package-contract.test.mjs | New contract test guarding that safe scripts remain defined and whole-catalog bootstrap/repair scripts remain absent; reads package.json with a relative path that is CWD-dependent. |
| i18next.config.ts | New i18next-cli config: routes extraction output to ORCA_I18N_EXTRACTION_OUTPUT env var (defaulting to tmp/), restricts locales to en, and configures function names, sorting, and removeUnusedKeys. |
| src/renderer/src/components/native-chat/NativeChatToolRun.tsx | Split single ternary translate() call into two independent calls (countOne / countN), adding countN with {{value0}} interpolation; newly declared in en.json, no target catalog entries exist yet. |
| src/renderer/src/components/settings/shortcuts-search.ts | Renamed key ca6a0c2df7 ("shortcut", no placeholder) to groupShortcut ("{{value0}} shortcut") — fixes a bug where English users saw "shortcut" without the group name; old key becomes an orphan. |
| .github/CODEOWNERS | New CODEOWNERS file assigning localization-related paths (locales/, localization.mjs, locale.mjs, i18next.config.ts) to @brennanb2025. |
| src/renderer/src/i18n/locales/en.json | Adds 8 new English entries (countOne, countN, remoteCloneParentPlaceholder, groupShortcut, closedToast, turns, events, sessions •) that are intentionally absent from all four target catalogs. |
Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/scripts/verify-localization-catalog.test.mjs (1)
97-124: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the plugin-only diagnostic.
The fixture includes
auto.pluginOnly, but the test never verifies that theextradiagnostic reports it. Add an assertion so regressions in plugin-only-key reporting are caught.Suggested assertions
expect(report).toHaveBeenCalledWith(expect.stringContaining('0/2 core keys')) + expect(report).toHaveBeenCalledWith(expect.stringContaining('extra')) + expect(report).toHaveBeenCalledWith(expect.stringContaining('auto.pluginOnly')) expect(report).toHaveBeenCalledWith(expect.stringContaining('interpolation mismatch'))
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 349bcccf-1535-47cd-b10e-8ae2450f6260
📒 Files selected for processing (3)
.github/workflows/pr.ymlconfig/scripts/verify-localization-catalog.mjsconfig/scripts/verify-localization-catalog.test.mjs
* Decouple feature copy from locale parity * Fix undeclared dynamic localization key check * Fix localization code owner
This replaces #8501 with the small, independently useful part of the localization change. Feature copy can now land without fabricating target-language entries, while the permanent bilingual translation source remains a separate follow-up.
ELI5: what are we doing?
Imagine Orca has five phrasebooks: English, Spanish, Japanese, Korean, and Chinese.
Today, whenever someone adds a sentence to the English phrasebook, our tools require adding something to all four translated phrasebooks immediately. If nobody has translated it yet, those books often receive copied English. That makes them look complete even though they are not.
The plan is:
Afterward, the everyday workflow is simple:
The previous large PR tried to create a custom index card for every existing sentence in every language before introducing the permanent binder. This split avoids making that temporary index-card system part of Orca's architecture.
What changed
sync:localization-catalogadds English declarations only and never edits target catalogs.i18next-cliextraction runs once in normal PR CI using isolated temporary output rather than a committed second English catalog.en.jsonand incompatible inline placeholders; legacy orphans, dynamic defaults, and wording-only drift are reported without a permanent disposition database.Explicitly deferred
This PR does not add per-locale state sidecars, Git-history-derived product semantics, a reviewed-correction ledger, committed extraction output, orphan dispositions, a broad main-process literal allowlist, generated key types, or a three-OS extraction matrix.
Reviewed/stale workflow state and cleanup of the existing extraction baseline belong in the permanent bilingual source migration. Until then, coverage and legacy extraction drift are honestly reported rather than represented as fully classified.
Whole localization plan
Design principles
PR A — decouple feature copy (this PR)
Land the smallest safe behavior change:
Temporary limitations accepted after PR A:
These are visible migration metrics, not claims of completeness. They must not grow into new state categories or permanent historical policy.
PR B — define the permanent source and compiler
Default format choice: XLIFF 2, unless implementation work identifies a documented blocker before this PR begins.
Add a narrow translation-source contract:
PR B must include golden compiler tests, source/target schema tests, placeholder tests, stale/missing fallback tests, and packaged-build integration. It must not import the full locale inventory yet; that keeps the format/compiler review separate from the data migration.
PR C — migrate existing translations once
Perform a byte-preserving migration into the permanent source:
Migration acceptance criteria:
PR D — switch ownership and delete the bridge
After migrated bundles are proven equivalent:
PR D is complete only when there is one canonical English representation, one canonical target representation per locale, no permanent Git-history interpretation, no correction-value duplication, and no large literal/disposition database.
Ownership, sequencing, and rollback
@brennanbensonuntil a broader localization owner/team is assigned.brennanb2025/i18n-architecture-improvements-fullfor migration evidence only and is not a merge candidate.Size
Validation
pnpm run typecheckpnpm run lintgit diff --checkThe worktree is clean and the branch is based on current
main. This PR should remain unmerged until live checks complete.