Skip to content

fix(i18n): localize status labels in settings and stats - #11826

Merged
AmethystLiang merged 3 commits into
stablyai:mainfrom
smwbev:fix/localize-remaining-settings-status-labels
Aug 2, 2026
Merged

AmethystLiang merged 3 commits into
stablyai:mainfrom
smwbev:fix/localize-remaining-settings-status-labels

Conversation

@smwbev

@smwbev smwbev commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

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.tsx shows the problem inside a single block:

{summaryTitle}                                        // literal → English
{translate('…ComputerUsePane.0c29da5805', 'Ready')}   // translated
{summaryDescription}                                  // literal → English
{translate(permission.labelKey, …)}                   // translated
{statusLabel(status)}                                 // literal → English

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.mjs inspects JSX attributes and object properties, not values returned by helper functions. pnpm verify:localization-coverage passes while the strings ship untranslated. A sweep for helpers named *Label/*Status/*Summary that 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

Area Strings
DeveloperPermissionsPane — macOS permission rows 7 statuses + 3 action labels
ComputerUsePane — permission rows and summary 3 statuses + 4 titles + 4 descriptions
cli-source-control-integration-cards — GitHub/GitLab cards 4 statuses
OrchestrationSkillAgentCoverage 5 coverage states
orchestration-usage-examples 5 card summaries
usage-overview-sections, StatsPane 3 provider statuses + tracking-since

Notes on the approach:

  • sync:localization-catalog added 31 keys; nothing was removed or reworded (11832 → 11863, 0 deletions, 0 value changes).
  • auto.components.settings.computerUseSummary.* already existed in en.json with identical copy — including the {{value0}}/{{value1}} placeholders — but nothing referenced it. Those keys are now wired up rather than duplicated.
  • Keys are stable and semantic (statusGranted, actionRequest) rather than content hashes, matching the direction in config/i18n-translation-source.md: "a feature developer adds a stable message ID and current English copy once".
  • Permission status helpers moved to developer-permission-status.ts so DeveloperPermissionsPane.tsx stays under the 400-line gate.
  • Agent prompt values in orchestration-usage-examples.ts are 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:

Settings → Integrations Settings → Computer Use
Integrations Computer Use
Connected / Not installed sit next to fully translated descriptions. Универсальный доступ GRANTED, and the heading reads Computer Use is ready. in English while the badge next to it is translated.
Settings → macOS Permissions Settings → Orchestration
macOS Permissions Orchestration
Nine rows of GRANTED / CHECK MANUALLY / ENTITLED, with Request, Trigger Prompt, Open Settings buttons. Card titles are translated, all five summaries stay English.

Stats & Usage is affected the same way (Enabled / Off per 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 lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added src/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. Dropping translate() for a literal again removes the key from en.json and 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) and src/relay/agent-exec-handler.test.ts (2). Both fail identically on a clean main with these changes stashed, so they are pre-existing environment failures, not regressions from this PR.

Note on CI: this PR comes from a fork, so PR Checks sits at action_required until a maintainer approves the workflow run — nothing has failed. The four checks below were run locally against this branch.

AI Review Report

Reviewed with Claude Opus 5.

  • Cross-platform. No platform branching added or changed. macOS only and Check manually stay behind the same DeveloperPermissionStatus values as before; the macOS-only panes keep their existing platform guards. No shortcuts, accelerators, labels, or path handling touched.
  • SSH / remote / local. No process, filesystem, credential, or network path touched. The changed helpers are pure renderer formatting.
  • Agents / integrations / git providers. cli-source-control-integration-cards.tsx is 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.
  • Performance. 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 no translate() runs at module scope — the no-top-level-translate test covers this.
  • UI quality. Wording is unchanged, so English layout is identical. Status pills keep their uppercase class; a translated value simply uppercases in its own script.
  • Catalog integrity. Verified programmatically: 31 keys added, 0 removed, 0 existing values modified. verify:localization-catalog and verify:localization-extraction pass.

The review flagged two things that were fixed before submitting: an unused type import left behind by the helper extraction, and a default branch that broke switch-exhaustiveness-check — restored as an explicit case 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

  • Follow-up worth considering: the coverage audit could grow a rule for helper functions that return user-facing literals. The sweep mentioned above found 57 such functions; the remaining ones include getCheckStatusLabel (duplicated across GitHubItemDialog, PullRequestPage, checks-panel-content), agentStateLabel, getAutomationRunStatusLabel, and getSidebarHostHealthLabel. Happy to send those as separate PRs if the approach here looks right.
  • How this was found. While building a full Russian language pack for Orca — smwbev/orca-russian, 11 613 strings, 98.2 % of 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.
  • The pack also confirms the plugin path works end to end: contributes.languagePacks + a marketplace index, no code execution, English fallback for missing keys.

X: @silentmegawatt · GitHub: @smwbev

@smwbev
smwbev requested a review from brennanb2025 as a code owner July 31, 2026 22:39
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]>
@smwbev
smwbev force-pushed the fix/localize-remaining-settings-status-labels branch from 5810b8d to 5dabd85 Compare July 31, 2026 22:41
@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d97e5457-a8f9-4db4-9caf-7c77fc32feef

📥 Commits

Reviewing files that changed from the base of the PR and between d9d86b3ea2aa5d55ee688171bf995a65ff300d8f and a685d66.

📒 Files selected for processing (14)
  • src/renderer/src/components/settings/ComputerUsePane.tsx
  • src/renderer/src/components/settings/DeveloperPermissionsPane.tsx
  • src/renderer/src/components/settings/OrchestrationSkillAgentCoverage.tsx
  • src/renderer/src/components/settings/cli-source-control-integration-cards.tsx
  • src/renderer/src/components/settings/developer-permission-status.ts
  • src/renderer/src/components/stats/StatsPane.tsx
  • src/renderer/src/components/stats/usage-overview-sections.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/settings-status-label-localization.test.ts
  • src/renderer/src/lib/orchestration-usage-examples.ts

📝 Walkthrough

Walkthrough

Localized 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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the main change: localizing status labels in Settings and Stats.
Description check ✅ Passed The description includes all required sections, detailed scope, testing results, AI review, security audit, and follow-up notes.

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: 2

🧹 Nitpick comments (1)
src/renderer/src/i18n/settings-status-label-localization.test.ts (1)

1-10: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Shorten 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

📥 Commits

Reviewing files that changed from the base of the PR and between fcb23e1 and 5dabd85.

📒 Files selected for processing (10)
  • src/renderer/src/components/settings/ComputerUsePane.tsx
  • src/renderer/src/components/settings/DeveloperPermissionsPane.tsx
  • src/renderer/src/components/settings/OrchestrationSkillAgentCoverage.tsx
  • src/renderer/src/components/settings/cli-source-control-integration-cards.tsx
  • src/renderer/src/components/settings/developer-permission-status.ts
  • src/renderer/src/components/stats/StatsPane.tsx
  • src/renderer/src/components/stats/usage-overview-sections.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/settings-status-label-localization.test.ts
  • src/renderer/src/lib/orchestration-usage-examples.ts

@greptile-apps

greptile-apps Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Greptile Summary

This 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.

  • 31 new semantic keys added across 6 namespaces (ComputerUsePane, DeveloperPermissionsPane, cli-source-control-integration-cards, OrchestrationSkillAgentCoverage, StatsPane, usage-overview-sections); no existing values deleted or changed outside the permissionsRequired → _one/_other plural migration.
  • Lazy getter pattern used for actionLabel properties in the PERMISSIONS array (and the extracted developer-permission-status.ts module) so translate() is never called at module scope, staying compliant with the repo's no-top-level-translate rule.
  • New regression test (settings-status-label-localization.test.ts) pins 26 catalog-contract assertions — key presence, placeholder integrity, and plural-family completeness across shipped locales — closing the audit gap that previously allowed these strings to ship untranslated.

Confidence Score: 5/5

Safe 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.

Important Files Changed

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]
Loading

Reviews (4): Last reviewed commit: "CodeRabbit's nitpick: the placeholder/pl..." | Re-trigger Greptile

@smwbev

smwbev commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Review follow-up pushed (c773c59)

All four review comments are addressed. Summary of what changed and one finding worth flagging.

Plural handling. permissionsRequired no longer appends an English s through {{value1}}; it passes count and the catalog carries _one/_other. This was not only an English-centric shortcut — it was already corrupting shipped locales: ko rendered 권한s이 and zh rendered 权限s for any count above one. es now has both forms, ko and zh a single correct one, and the untranslated ja entry is retired so it falls back to English as it did before.

Date formatting. Tracking since now formats with the selected UI language via a new getIntlLocale() helper instead of the OS locale. The helper also handles the plugin case: a plugin catalog's synthetic plugin<hex> resource language is not a valid BCP-47 tag, so it resolves to the locale the pack declares.

Test coverage. The regression test gained the six computerUseSummary.* title/description keys it had missed, plus the plural contract, and the header was shortened.

Finding: plural rules do not reach plugin language packs

While fixing the above I measured how plurals resolve for a plugin-supplied catalog, since those register under pluginLanguageResourceId():

ru          → 1 разрешение / 2 разрешения / 5 разрешений   ✅ three forms
plugin<hex> → 1 разрешение / 2 разрешения / 5 разрешения   ❌ two-form default

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 locale looks like the fix; happy to send it as a separate PR.

Checks

pnpm lint, pnpm typecheck, pnpm build pass. pnpm test: 42 599 passed, 76 skipped; the two failing files (ssh-posix-command-wrapper, agent-exec-handler) fail identically on a clean main with this branch stashed.

@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

🧹 Nitpick comments (1)
src/renderer/src/i18n/settings-status-label-localization.test.ts (1)

90-101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Validate 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.tsx
  • src/renderer/src/components/stats/StatsPane.tsx
  • src/renderer/src/i18n/i18n.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/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

Comment thread src/renderer/src/i18n/i18n.ts Resolved
@smwbev
smwbev force-pushed the fix/localize-remaining-settings-status-labels branch 2 times, most recently from c9df5ab to d9d86b3 Compare July 31, 2026 23:15
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:
@AmethystLiang
AmethystLiang force-pushed the fix/localize-remaining-settings-status-labels branch from d9d86b3 to a685d66 Compare August 2, 2026 08:30
@AmethystLiang
AmethystLiang merged commit 0d38053 into stablyai:main Aug 2, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* 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]>
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.

2 participants