Repository navigation
fix(i18n): localize status labels in settings and stats - #11826
AmethystLiang merged 3 commits into
Conversation
Status pills and summaries in Settings and Stats were built from bare string literals inside local helper functions, so they stayed English even when a language pack was active. Neighbouring copy in the same components already went through `translate()`, which made the panes look half-translated: "Универсальный доступ GRANTED", "GitHub ... Connected", Russian orchestration card titles above English summaries. The coverage audit does not catch this: it inspects JSX attributes and object properties, not values returned by helpers, so `verify:localization-coverage` stays green while the strings ship untranslated. Wrapped the remaining user-facing strings in `translate()` and let `sync:localization-catalog` add the 31 new keys. `computerUseSummary.*` already existed in `en.json` with identical copy but was never wired up, so those keys are now connected instead of duplicated. Moved the permission status helpers into `developer-permission-status.ts` to keep `DeveloperPermissionsPane.tsx` under the 400-line gate. Agent prompts in `orchestration-usage-examples.ts` are left in English on purpose: they are payload sent to the agent, not UI copy. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
5810b8d to
5dabd85
Compare
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between d9d86b3ea2aa5d55ee688171bf995a65ff300d8f and a685d66. 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughLocalized hard-coded text across settings, statistics, Computer Use, permissions, integrations, and orchestration views. Added English and updated language-specific catalog entries with interpolation and plural forms. Added shared developer permission status helpers and localization contract tests. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/renderer/src/i18n/settings-status-label-localization.test.ts (1)
1-10: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueShorten this comment.
Lines 1-10 repeat test implementation details. Replace them with one concise rationale.
As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2c97ef21-1935-41e9-b376-14b17f18a914
📒 Files selected for processing (10)
src/renderer/src/components/settings/ComputerUsePane.tsxsrc/renderer/src/components/settings/DeveloperPermissionsPane.tsxsrc/renderer/src/components/settings/OrchestrationSkillAgentCoverage.tsxsrc/renderer/src/components/settings/cli-source-control-integration-cards.tsxsrc/renderer/src/components/settings/developer-permission-status.tssrc/renderer/src/components/stats/StatsPane.tsxsrc/renderer/src/components/stats/usage-overview-sections.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/settings-status-label-localization.test.tssrc/renderer/src/lib/orchestration-usage-examples.ts
Greptile SummaryThis PR fixes a systematic i18n gap where status labels, action buttons, and summary strings in Settings and Stats panes were returned from local helper functions as bare string literals — bypassing the localization catalog entirely and rendering in English regardless of the active language pack.
Confidence Score: 5/5Safe to merge — the change is purely additive catalog wiring with no behavioral change in English builds and no code paths touched outside the renderer's formatting helpers. Every changed helper is a pure string formatter that takes a status enum value and returns a translated label. All existing English defaults are preserved verbatim as translate() fallbacks, so English builds render identically. The lazy getter pattern correctly defers translate() calls to access time, switch exhaustiveness is maintained in all helpers, the plural migration in shipped locale files is consistent, and the new regression test closes the audit gap that allowed these strings to ship untranslated. No logic, data flow, IPC, or auth surface is touched. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/settings/developer-permission-status.ts | New file extracting statusLabel/statusClass helpers from DeveloperPermissionsPane; all 7 status cases now go through translate() with semantic keys, switch is exhaustive. |
| src/renderer/src/components/settings/ComputerUsePane.tsx | All three status labels and four summary title/description strings now go through translate(); permissionsRequired plural replaced with _one/_other forms. |
| src/renderer/src/components/settings/DeveloperPermissionsPane.tsx | statusLabel/statusClass helpers extracted to developer-permission-status.ts; nine actionLabel strings converted from plain literals to lazy getter translate() calls to prevent top-level evaluation. |
| src/renderer/src/components/settings/cli-source-control-integration-cards.tsx | New integrationStatusLabel() helper consolidates GitHub and GitLab status labels through translate(); checking case returns '' (intentional, controlled by separate checking prop). |
| src/renderer/src/i18n/locales/en.json | 31 new semantic keys added across 6 namespaces; permissionsRequired replaced with _one/_other plural forms; no existing values changed. |
| src/renderer/src/i18n/settings-status-label-localization.test.ts | New regression test file with 26 assertions pinning catalog contract; covers REQUIRED_KEYS existence, interpolation placeholder integrity, plural family completeness, and orchestration summary keys. |
| src/renderer/src/components/settings/OrchestrationSkillAgentCoverage.tsx | Five coverage-state strings now use translate(); fullCoverage split into _one/_other forms with a count guard matching the pluralization approach elsewhere in the PR. |
| src/renderer/src/components/stats/StatsPane.tsx | formatTrackingSince wraps 'Tracking since {{value0}}' in translate(); formatted date passed as value0 interpolation, preserving existing locale-aware date formatting. |
| src/renderer/src/components/stats/usage-overview-sections.tsx | Provider status ternary (Scanning/Enabled/Off) now resolved through translate(); other diff is whitespace-only reformatting with no semantic change. |
| src/renderer/src/lib/orchestration-usage-examples.ts | Five summary strings converted from bare literals to translate() calls; prompt values intentionally left as English literals per PR description. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Component render] --> B{Helper function}
B -->|Before PR| C[Bare string literal]
B -->|After PR| D[translate with key and fallback]
D --> E{Key in active locale catalog?}
E -->|Yes| F[Localized string]
E -->|No| G[English fallback]
C --> H[Always English]
F --> I[Status pill displayed]
G --> I
H --> J[Status pill English only]
Reviews (4): Last reviewed commit: "CodeRabbit's nitpick: the placeholder/pl..." | Re-trigger Greptile
Review follow-up pushed (c773c59)All four review comments are addressed. Summary of what changed and one finding worth flagging. Plural handling. Date formatting. Test coverage. The regression test gained the six Finding: plural rules do not reach plugin language packsWhile fixing the above I measured how plurals resolve for a plugin-supplied catalog, since those register under i18next cannot map the synthetic tag to CLDR rules, so a plugin pack gets English plural behaviour regardless of the language it actually provides. Everything in this PR is correct for the bundled locales and no worse than before for plugin packs, but the underlying limitation stays. Resolving plural rules from the pack's declared Checks
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/renderer/src/i18n/settings-status-label-localization.test.ts (1)
90-101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winValidate plural placeholders in every shipped catalog.
These assertions read only
enCatalog. They cannot detect a translated catalog that still uses{{value1}}or lacks the plural key required by its locale. Extend the placeholder and plural-key checks to the shipped locale catalogs, while keeping exact English-value assertions separate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 658d817f-96ea-4f0c-85a7-9cdc7409339b
📥 Commits
Reviewing files that changed from the base of the PR and between 5dabd85 and c773c59eee03b7559de260c3b2c0eaa060bd7785.
📒 Files selected for processing (9)
src/renderer/src/components/settings/ComputerUsePane.tsxsrc/renderer/src/components/stats/StatsPane.tsxsrc/renderer/src/i18n/i18n.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/i18n/settings-status-label-localization.test.ts
💤 Files with no reviewable changes (1)
- src/renderer/src/i18n/locales/ja.json
🚧 Files skipped from review as they are similar to previous changes (3)
- src/renderer/src/components/stats/StatsPane.tsx
- src/renderer/src/components/settings/ComputerUsePane.tsx
- src/renderer/src/i18n/locales/en.json
c9df5ab to
d9d86b3
Compare
Replace template-based pluralization (using {{value1}} for "s") with
proper i18n plural forms following _one/_other suffixes. This enables
correct pluralization across languages with distinct rules.
Also extract duplicate integration status label translation logic
into a helper function.
…tatus-label-localization.test.ts only read en.json, so a translated catalog could ship a stale {{value1}} or a half-translated plural family undetected.
Added a second describe block over the four shipped locale catalogs (es, ja, ko, zh), keeping the exact English-value assertions untouched and separate:
d9d86b3 to
a685d66
Compare
* fix(i18n): localize status labels in settings and stats Status pills and summaries in Settings and Stats were built from bare string literals inside local helper functions, so they stayed English even when a language pack was active. Neighbouring copy in the same components already went through `translate()`, which made the panes look half-translated: "Универсальный доступ GRANTED", "GitHub ... Connected", Russian orchestration card titles above English summaries. The coverage audit does not catch this: it inspects JSX attributes and object properties, not values returned by helpers, so `verify:localization-coverage` stays green while the strings ship untranslated. Wrapped the remaining user-facing strings in `translate()` and let `sync:localization-catalog` add the 31 new keys. `computerUseSummary.*` already existed in `en.json` with identical copy but was never wired up, so those keys are now connected instead of duplicated. Moved the permission status helpers into `developer-permission-status.ts` to keep `DeveloperPermissionsPane.tsx` under the 400-line gate. Agent prompts in `orchestration-usage-examples.ts` are left in English on purpose: they are payload sent to the agent, not UI copy. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(i18n): use plural-aware message keys for settings labels Replace template-based pluralization (using {{value1}} for "s") with proper i18n plural forms following _one/_other suffixes. This enables correct pluralization across languages with distinct rules. Also extract duplicate integration status label translation logic into a helper function. * CodeRabbit's nitpick: the placeholder/plural assertions in settings-status-label-localization.test.ts only read en.json, so a translated catalog could ship a stale {{value1}} or a half-translated plural family undetected. Added a second describe block over the four shipped locale catalogs (es, ja, ko, zh), keeping the exact English-value assertions untouched and separate: --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Jinjing <[email protected]>
Summary
Status pills and summaries in Settings and Stats were built from bare string literals inside local helper functions, so they stayed English even with a language pack active. Neighbouring copy in the same components already goes through
translate(), which makes those panes look half-translated.ComputerUsePane.tsxshows the problem inside a single block:Result in a localized build:
Универсальный доступ GRANTED,GitHub … Connected, and orchestration cards with translated titles above English summaries.Why the coverage gate did not catch it.
audit-localization-coverage.mjsinspects JSX attributes and object properties, not values returned by helper functions.pnpm verify:localization-coveragepasses while the strings ship untranslated. A sweep for helpers named*Label/*Status/*Summarythat return literals found 57 such functions across the renderer; this PR fixes the ones users hit on the Settings and Stats screens and leaves the rest for follow-up.What changed
DeveloperPermissionsPane— macOS permission rowsComputerUsePane— permission rows and summarycli-source-control-integration-cards— GitHub/GitLab cardsOrchestrationSkillAgentCoverageorchestration-usage-examplesusage-overview-sections,StatsPaneNotes on the approach:
sync:localization-catalogadded 31 keys; nothing was removed or reworded (11832 → 11863, 0 deletions, 0 value changes).auto.components.settings.computerUseSummary.*already existed inen.jsonwith identical copy — including the{{value0}}/{{value1}}placeholders — but nothing referenced it. Those keys are now wired up rather than duplicated.statusGranted,actionRequest) rather than content hashes, matching the direction inconfig/i18n-translation-source.md: "a feature developer adds a stable message ID and current English copy once".developer-permission-status.tssoDeveloperPermissionsPane.tsxstays under the 400-line gate.promptvalues inorchestration-usage-examples.tsare deliberately left in English: they are payload sent to the agent, not UI copy.Screenshots
No visual change in English — every string keeps its exact English wording, so an English build renders identically.
The defect is only visible in a localized build. These are from a Russian language pack on current
main, before this PR:Connected/Not installedsit next to fully translated descriptions.Универсальный доступ GRANTED, and the heading readsComputer Use is ready.in English while the badge next to it is translated.GRANTED/CHECK MANUALLY/ENTITLED, withRequest,Trigger Prompt,Open Settingsbuttons.Stats & Usage is affected the same way (
Enabled/Offper provider,Tracking since …in the header); that screenshot is omitted because the pane shows account spend.After this change those strings resolve through the catalog and follow the selected language, falling back to the same English text when a locale has no value.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildsrc/renderer/src/i18n/settings-status-label-localization.test.ts— 26 assertions pinning the catalog contract for these keys, including placeholder integrity for the interpolated ones. Droppingtranslate()for a literal again removes the key fromen.jsonand fails the test.pnpm test: 42 550 passed, 78 skipped. Two files fail on this machine —src/main/ssh/ssh-posix-command-wrapper.test.ts(3) andsrc/relay/agent-exec-handler.test.ts(2). Both fail identically on a cleanmainwith these changes stashed, so they are pre-existing environment failures, not regressions from this PR.AI Review Report
Reviewed with Claude Opus 5.
macOS onlyandCheck manuallystay behind the sameDeveloperPermissionStatusvalues as before; the macOS-only panes keep their existing platform guards. No shortcuts, accelerators, labels, or path handling touched.cli-source-control-integration-cards.tsxis shared by GitHub and GitLab; both call sites were updated together and keep identical status semantics. Agent prompts were intentionally not localized so agent behaviour is unchanged.translate()calls happen in render paths that already call it for neighbouring copy. The permission definitions use the file's existing lazy-getter pattern, so notranslate()runs at module scope — theno-top-level-translatetest covers this.uppercaseclass; a translated value simply uppercases in its own script.verify:localization-catalogandverify:localization-extractionpass.The review flagged two things that were fixed before submitting: an unused type import left behind by the helper extraction, and a
defaultbranch that brokeswitch-exhaustiveness-check— restored as an explicitcase undefined.Security Audit
Reviewed with Claude Opus 5. No new input handling, command execution, path handling, auth, secrets, or IPC surface. The diff converts string literals into catalog lookups; interpolated values (
helperUnavailableReason, permission counts, provider counts, formatted dates) were already rendered into the same strings and are passed as i18next interpolation parameters, which escape by default in React rendering. No dependency changes. No follow-up needed.Notes
getCheckStatusLabel(duplicated acrossGitHubItemDialog,PullRequestPage,checks-panel-content),agentStateLabel,getAutomationRunStatusLabel, andgetSidebarHostHealthLabel. Happy to send those as separate PRs if the approach here looks right.en.json. Translating the whole catalog surfaces exactly the strings that never reach it: everything in this PR was invisible to the catalog, so no amount of translation work could fix it downstream.contributes.languagePacks+ a marketplace index, no code execution, English fallback for missing keys.X: @silentmegawatt · GitHub: @smwbev