Skip to content

fix(i18n): localize the status bar Resource Manager tooltip and remote-host count - #12478

Merged
nwparker merged 3 commits into
mainfrom
nwparker/bugpr-12439
Aug 7, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/bugpr-12439

Conversation

@nwparker

@nwparker nwparker commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

What was broken (ELI5)

If you set Orca's language to Japanese (or Spanish, Korean, Chinese), most of the app translates — but two bits of the bottom status bar stubbornly stayed in English. Hovering the Resource Manager showed an English tooltip ("Resource Manager - 3.69 GB · Σ RSS - 2 terminal sessions"), and the remote-hosts pill next to it read "2 hosts" even though the label a screen reader announced for the very same button was already Japanese. Now every line of that tooltip and the host count read in your chosen language, and the highlighted "space scan ready" row keeps its highlight in every language instead of only English.

Root cause

Two independent layers.

1. The strings. They were assembled from bare literals inside helper functions rather than looked up in the catalog:

  • src/renderer/src/components/status-bar/resource-manager-terminal-copy.ts:1-2 — `${count} terminal session${count === 1 ? '' : 's'}`
  • resource-manager-terminal-copy.ts:13,16,20,24,26 — 'memory unavailable', the Resource Manager - … - … summary, 'Space scan ready', 'Terminal sessions are grouped by workspace.', 'No terminal sessions yet.'
  • src/renderer/src/components/status-bar/SshStatusSegment.tsx:65-67 — `${count} ${count === 1 ? 'host' : 'hosts'}`
  • SshStatusSegment.tsx:346 — the ?? 'Connecting…' fallback and the adjacent 'Workspace conflict' / 'Workspace sync error' ternary

SshStatusSegment.tsx already imports translate at line 13 and uses it for every other label in the same render path, which is exactly the inconsistency the report names. grep -n "SshStatusSegment" src/renderer/src/i18n/locales/en.json shows the section at line 3186 has no host-count key, and no terminal session / Space scan ready key exists anywhere in en.json.

2. Why the gate let it ship. classifyStringNode in config/scripts/audit-localization-coverage.mjs:311-366 only returns a kind for jsx-attribute / jsx-text / jsx-expression / user-visible-call / object-property, so a literal in a return statement classifies as undefined. It also bails at lines 316-322 on any ancestor binary expression whose operator is not + — which hides not just ?? 'Connecting…' but every string nested under a cond && <JSX/> guard. Running the audit's own collectLocalizationCandidates over both files returns 0 candidates, and node config/scripts/audit-localization-coverage.mjs --check passed clean on main.

3. A latent bug the fix surfaces (found by @smwbev, see below). ResourceUsageStatusSegment.tsx:1193 tinted one tooltip row by comparing it against the English text:

className={line === 'Space scan ready' ? 'text-primary' : ''}

That comparison stops matching the instant the copy comes from the catalog, so simply routing the string through translate() silently drops the highlight in every non-English build.

The fix

Strings. Every literal in the status-bar render path now goes through translate(). The Resource Manager copy stays in resource-manager-terminal-copy.ts; the SSH labels move into a new ssh-status-segment-copy.ts, mirroring the directory's existing resource-memory-metric-copy.ts convention. That extraction was also forced: adding translate() inline pushed SshStatusSegment.tsx from 394 to 415 effective lines, past the 400 max-lines cap, and AGENTS.md forbids adding a disable.

The tooltip summary and the aria label are whole-line keys (Resource Manager - {{memory}} - {{sessions}}, Resource Manager, {{sessions}}, {{spaceScan}}) rather than fragments joined with ' - ' / ', '. Those separators and that word order are sentence structure: ja and zh reorder and repunctuate them (、 / ,), which is visible in the screenshots below.

Catalog entries land in all five locales with real translations, reusing terminology already in the catalog (リソースマネージャー / 资源管理器 / Administrador de recursos, 台のホスト / 个主机, 接続中…). Both _one and _other are supplied per locale on purpose: the code picks the suffix, so a ja catalog with only _other would render the English _one source at count === 1.

The tint. getResourceManagerTooltipLines now returns { text, emphasized }[] and the segment reads the flag, so the highlight no longer depends on the row's wording.

Gate. classifyStringNode now keeps walking through ??, || and && ancestors — only comparison operands are code — with the same set applied in isRenderedJsxExpression. That surfaced exactly 5 new candidates: 4 genuine unlocalized strings, now localized (StatusBar's ', new activity' aria label, the duplicated 'Refresh CLI registration status and try again.' toast description in CliSkillRuntimeSetup and agent-skill-cli-prerequisite, and worktree-activation's 'Cannot open folder workspace' toast title), and 1 false positive (label="sidebar" is a 'sidebar' | 'source-control' variant discriminator on DetachedHeadBadge), which got an allowlist entry.

I deliberately did not close the other half of the gate blind spot (classifying strings returned from helpers). I measured it with a probe reusing the audit's own AST walk: 1056 candidates across the renderer, most real but some noise (Tailwind class strings from : string helpers, e.g. overallDotColor returning 'bg-emerald-500'). A 1000-entry allowlist inside a bug fix would be unreviewable and would freeze the backlog in place. Instead I followed the repo's own established remediation for exactly this blind spot — src/renderer/src/i18n/settings-status-label-localization.test.ts, whose docblock names the same root cause — and pinned the contract with a runtime test that switches the real i18n instance to Japanese.

Reproduction

Base commit: git log --oneline -1 → 29bfc1e22c Fix Windows git/gh attribution wrappers rejecting a piped stdin argument (#12440).

A scratch vitest (since deleted) switched the real i18n instance to Japanese, called the real exported copy helpers, and rendered the real SshStatusSegment with 2 connected SSH targets:

i18n.language = ja
sanity, a real catalog key = リモートホスト
tooltip lines = [
  "Resource Manager - 512 MB - 2 terminal sessions",
  "Space scan ready",
  "Terminal sessions are grouped by workspace."
]
aria = Resource Manager, 1 terminal session, Space scan ready
count(1) = 1 terminal session
count(5) = 5 terminal sessions
 ✓ ... > shows what the Resource Manager copy renders under a Japanese UI 2ms
trigger aria-label = リモートホスト接続状態
trigger text = "2 hosts"
 ✓ ... > shows what the remote host count renders under a Japanese UI 227ms

 Test Files  1 passed (1)
      Tests  2 passed (2)

With the UI in Japanese, the trigger's aria-label renders リモートホスト接続状態 but its visible text renders the English 2 hosts, and the whole tooltip stays English.

The gate blind spot, via a probe calling the audit's own collectLocalizationCandidates:

### src/renderer/src/components/status-bar/resource-manager-terminal-copy.ts -> 0 candidates
### src/renderer/src/components/status-bar/SshStatusSegment.tsx -> 0 candidates

and node config/scripts/audit-localization-coverage.mjs --check → Localization coverage check passed with 12 allowlisted candidates.

Regression tests fail without the source fix. Reverting only the source files (git checkout 29bfc1e22c -- <sources>, keeping the new tests) gives Test Files 4 failed (4) / Tests 13 failed | 3 passed (16):

AssertionError: expected '1 terminal session' to be '1 件のターミナルセッション'
AssertionError: expected '2 hosts' to contain '2 台のホスト'
AssertionError: expected '1 host' to contain '1 台のホスト'
AssertionError: expected 'Connecting…' to contain '接続中…'
AssertionError: expected 'Resource Manager, 1 terminal session,…' to be 'リソースマネージャー、1 件のターミナルセッション、容量スキャンの準備完了'
AssertionError: expected [] to deeply equal [ 'Space scan ready' ]     # emphasized flag
AssertionError: expected [] to have a length of 1 but got +0           # tint under ja
AssertionError: expected [] to deeply equal [ 'Connecting…', 'Idle' ]  # audit: ?? / || fallback
AssertionError: expected [] to deeply equal [ 'Retry the sync' ]       # audit: && JSX guard

Visual proof

Rendered through a scratch Vite harness (deleted before commit) that mounts the real exported copy helpers and the real main.css tokens with i18n.changeLanguage('ja'), inside the real TooltipContent surface classes (bg-foreground … text-background). Three states, same harness, only the source files swapped by git checkout.

1. Before (main, 29bfc1e) — the tooltip, the screen-reader label and the host pill are all English under a Japanese UI. The space-scan row is highlighted:

proof-before.png

2. Localizing the strings alone — copy is Japanese, but the space-scan row has silently lost its highlight, because line === 'Space scan ready' no longer matches. This is the regression @smwbev caught:

proof-intermediate.png

3. After (this PR) — translated and the highlight is back, now driven by the emphasized flag. Note the 、 separators in the screen-reader label, which is why the aria label is a whole-line key:

proof-after.png

Relationship to #12439

Full credit to @smwbev for finding, reporting and diagnosing this in #12439 — including correctly identifying that audit-localization-coverage.mjs cannot see values returned from helper functions, which is why the strings shipped untranslated in the first place. I worked the fix independently before reading their PR, then cross-referenced.

What I took from #12439: the { text, emphasized } tooltip-line shape, and the reason for it. My independent fix localized 'Space scan ready' but left ResourceUsageStatusSegment.tsx:1193 comparing the row against its English text — a real regression in my version that @smwbev caught and I did not. Their structural fix (return the flag, don't re-derive it from wording) is strictly better than the alternative of exporting the label helper and comparing against spaceScanReadyLabel(), because it can't drift. Their unit test for the flag is adopted too, and extended with a ja-locale assertion that the emphasized row's text is not 'Space scan ready'. Commit 6d1fdbc is co-authored to them.

What I did differently:

Closes #12439's issue; happy to defer to that PR on anything I got wrong.

Testing

$ npx vitest run --config config/vitest.config.ts src/renderer/src/components/status-bar/ src/renderer/src/i18n/ config/scripts/
 Test Files  142 passed (142)
      Tests  1028 passed | 5 skipped (1033)

$ npx vitest run --config config/vitest.config.ts src/renderer/src/lib/worktree-activation src/renderer/src/lib/agent-skill-cli-prerequisite src/renderer/src/components/settings/CliSkillRuntimeSetup
 Test Files  6 passed (6)
      Tests  86 passed (86)

$ npx tsc --noEmit -p config/tsconfig.tc.web.json     # clean
$ npx tsc --noEmit -p config/tsconfig.node.json       # clean
$ npx oxlint src/renderer/src/components/status-bar/  # clean
$ npx oxfmt --check src/renderer/src/components/status-bar/
All matched files use the correct format.

$ npm run audit:code-quality:native                   # clean
$ npm run check:max-lines-ratchet
max-lines ratchet OK — 352 grandfathered suppression(s), no new bypasses.

$ node config/scripts/audit-localization-coverage.mjs --check
Localization coverage check passed with 13 allowlisted candidates.

$ node config/scripts/verify-localization-catalog.mjs
Verified 11149 localization key references against en.json.
es.json coverage: 11825/12002 translated, 177 missing.
ja.json coverage: 11825/12002 translated, 177 missing.
ko.json coverage: 11825/12002 translated, 177 missing.
zh.json coverage: 11829/12002 translated, 173 missing.

$ node config/scripts/verify-localization-extraction.mjs
Extracted 9901 keys; 29 dynamic defaults are report-only, 2101 existing English
entries are not statically referenced, and 41 inline defaults differ.   # exit 0

Cross-platform: this change is UI copy and its lookup path only — no paths, shells, accelerators or platform APIs. Connecting… keeps U+2026, already used in the file. The memory label (3.69 GB · Σ RSS) is produced upstream by memoryMetricCopy and passes through as an interpolation value unchanged. Nothing here assumes a git worktree over a folder workspace, or local execution over SSH.

Open questions for a maintainer

  1. The helper-return half of the audit gap (1056 candidates) is left open on purpose. Worth its own PR plus a filter for : string helpers that return Tailwind classes/ids.
  2. ja/ko/zh get identical _one and _other values because those languages don't inflect — required because the code picks the suffix. Confirm that matches how the localization team wants plural families filled.
  3. connectedHostCount_* / connecting / workspaceConflict / workspaceSyncError keep the auto.components.status.bar.SshStatusSegment.* prefix even though the helpers now live in ssh-status-segment-copy.ts, to avoid catalog churn. Nothing enforces file/key correspondence; say the word if you'd rather have the file-derived prefix.

Made with Orca 🐋

@nwparker
nwparker requested a review from brennanb2025 as a code owner August 4, 2026 07:51
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR expands localization coverage detection for fallback and conditional expressions. It localizes CLI registration, worktree activation, floating-terminal, Resource Manager, and SSH status-bar copy. Resource Manager tooltip lines now include stable IDs and emphasis metadata. New translation entries were added for English, Spanish, Japanese, Korean, and Chinese locales. Tests cover analyzer behavior, tooltip structure, SSH labels, and Japanese status-bar rendering.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Title check ✅ Passed The title clearly summarizes the primary localization changes to the Resource Manager tooltip and remote-host count.
Description check ✅ Passed The description thoroughly covers the user-visible changes, screenshots, testing, cross-platform review, risks, and follow-up items.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@smwbev

smwbev commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Three notes on your open questions, from having hit all of them.

1. The Tailwind filter you want already exists

You asked for "a filter for : string helpers that return Tailwind classes/ids". That is what produced the 87/214 number I posted on #12439 — the scan drops a literal when every whitespace-separated token matches ^(bg|text|border|ring|fill|stroke|from|to|via|hover|dark|group|animate|size|w|h|p[xytblr]?|m[xytblr]?|flex|grid|rounded|shadow|opacity|z|gap)- or contains /.

Concretely, in checks-panel-content.tsx that separates getCheckStatusLabel() returning Successful / Failed / Timed out (real) from prStateColor() returning bg-purple-500/15 text-purple-500 border-purple-500/20 (noise). Without it the same file reads as 14 candidates instead of 10.

One residue the filter does not catch: proper nouns. usage-error-copy.ts has getProviderDisplayName() returning Claude / Codex / Grok, which is 8 of the 214 and should stay English. So treat the number as an upper bound.

2. Identical _one/_other is the right call for ja/ko/zh — and the ceiling for others

Your reading is correct: because the code picks the suffix, both keys have to exist even where the language does not inflect, and identical values are honest for ja/ko/zh.

Worth knowing what that costs elsewhere, since it is the same mechanism. Russian has three CLDR plural categories — one (1, 21, 31…), few (2–4, 22–24…), many (0, 5–20…) — and a code-side === 1 split can express only two of them. 2 сессии and 5 сессий are different words; either one is wrong under a two-way branch. Polish, Czech, Ukrainian, Arabic and Welsh have the same shape.

For plugin language packs it is worse and neither mechanism helps: those register under a synthetic plugin<hex> resource language, which i18next cannot map to a locale, so CLDR selection never runs and English plural rules apply regardless of what the catalog contains. I verified that experimentally — ru resolves three forms, plugin<hex> resolves two.

That is what #12106 is about, and your question 2 is the same wall from the built-in side. Practical workaround we use meanwhile: phrase the _other value so it is count-agnostic (сессий терминала: {{count}} reads correctly for 2, 5 and 21 alike), which sidesteps the branch entirely. Not a fix — just what keeps a shipped pack honest.

3. Keeping the SshStatusSegment.* prefix matches precedent

There is a merged precedent for exactly your choice. In #11826 the permission helpers moved out of DeveloperPermissionsPane.tsx into developer-permission-status.ts to stay under the 400-line gate, and the keys kept the auto.components.settings.DeveloperPermissionsPane.* prefix. @AmethystLiang merged it without raising the mismatch.

So the component-derived prefix, not the file-derived one, is what the catalog already does after a helper extraction. Churning the keys would break that pattern rather than restore it.

nwparker and others added 3 commits August 6, 2026 19:05
…e-host count

The Resource Manager tooltip/aria label and the SSH segment's host count were
assembled from bare English literals inside helper functions, so they stayed
English under every non-English UI language while the labels around them
translated. Route them through the catalog with _one/_other plural keys and
whole-line messages (locales reorder and repunctuate the summary), and add
en/es/ja/ko/zh entries.

Root cause of the miss: audit-localization-coverage bailed on any ancestor
binary expression whose operator was not `+`, which hid every string under a
`cond && <JSX/>` guard or a `?? 'fallback'` — including this segment's
'Connecting…'. Only comparison operands are code, so keep `??`, `||` and
`&&` walking, and localize the four real strings that surfaced.

Co-authored-by: Orca <[email protected]>
…its English text

The tooltip tinted a row with `line === 'Space scan ready'`, so routing that
copy through the catalog silently dropped the tint in every translated build.
Return `{ text, emphasized }` and let the segment read the flag.

Adopted from #12439 by @smwbev.

Co-authored-by: Evgenii <[email protected]>

Co-authored-by: Orca <[email protected]>
@nwparker
nwparker force-pushed the nwparker/bugpr-12439 branch from efa07a2 to 2fabd80 Compare August 7, 2026 02:10
@nwparker
nwparker merged commit f2d62a7 into main Aug 7, 2026
43 checks passed
@nwparker
nwparker deleted the nwparker/bugpr-12439 branch August 7, 2026 02:14

@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: 5

🧹 Nitpick comments (2)
src/renderer/src/components/status-bar/resource-manager-terminal-copy.ts (1)

24-32: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Shorten the type comment.

The comment repeats implementation details and spans nine lines. Keep only the non-obvious stable-key invariant in one concise line.

As per coding guidelines, “Comments must be concise, limited to non-obvious information, and preferably one line.”

Source: Coding guidelines

src/renderer/src/components/status-bar/status-bar-copy-localization.test.tsx (1)

2-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Shorten the test rationale.

Keep this as a one- or two-line comment that states why runtime localization coverage is required. Remove the historical detail and cross-file comparison.

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: bb919fd9-16e7-4680-8104-3d2c9b077743

📥 Commits

Reviewing files that changed from the base of the PR and between c50a751 and 2fabd80.

📒 Files selected for processing (19)
  • config/localization-coverage-allowlist.json
  • config/scripts/audit-localization-coverage.mjs
  • config/scripts/audit-localization-coverage.test.mjs
  • src/renderer/src/components/settings/CliSkillRuntimeSetup.tsx
  • src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx
  • src/renderer/src/components/status-bar/SshStatusSegment.tsx
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/resource-manager-terminal-copy.test.ts
  • src/renderer/src/components/status-bar/resource-manager-terminal-copy.ts
  • src/renderer/src/components/status-bar/ssh-status-segment-copy.test.ts
  • src/renderer/src/components/status-bar/ssh-status-segment-copy.ts
  • src/renderer/src/components/status-bar/status-bar-copy-localization.test.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/lib/agent-skill-cli-prerequisite.ts
  • src/renderer/src/lib/worktree-activation.ts

Comment on lines +3 to +15
export function connectedHostCountLabel(count: number): string {
return count === 1
? translate(
'auto.components.status.bar.SshStatusSegment.connectedHostCount_one',
'{{count}} host',
{ count }
)
: translate(
'auto.components.status.bar.SshStatusSegment.connectedHostCount_other',
'{{count}} hosts',
{ count }
)
}

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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | rg 'ssh-status-segment-copy|src/renderer/src/i18n|language|pluginLanguage|addResourceBundle|translate\(' | head -200

echo
echo "== target file =="
cat -n src/renderer/src/components/status-bar/ssh-status-segment-copy.ts

echo
echo "== connectedHostCount occurrences =="
rg -n "connectedHostCount|connectedHost" .

echo
echo "== translation helper outline/files =="
fd -a '.*' src/renderer/src | rg '/i18n/|translate|language|resource' | head -200

Repository: stablyai/orca

Length of output: 14080


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== i18n.ts =="
cat -n src/renderer/src/i18n/i18n.ts

echo
echo "== localized catalog =="
cat -n src/renderer/src/i18n/localized-catalog.ts

echo
echo "== plugin packs outline/contents =="
cat -n src/renderer/src/store/plugin-language-packs.ts
rg -n "pluginLanguageResourceId|pluginLanguagePacks|languagePack|addResourceBundle|useStore|plural|defaultNS|fallbackLng|keySeparator|nsSeparator" src/renderer/src/src -S || true
rg -n "pluginLanguageResourceId|pluginLanguagePacks|languagePack|addResourceBundle|useStore|plural|defaultNS|fallbackLng|keySeparator|nsSeparator" src/renderer/src -S || true

echo
echo "== connectedHostCount locales exact sections =="
python3 - <<'PY'
import json, pathlib
for p in sorted(pathlib.Path('src/renderer/src/i18n/locales').glob('*.json')):
    data=json.loads(p.read_text())
    cur=data
    path='SshStatusSegment.connectedHostCount'
    for k in ['auto','components','status','bar','SshStatusSegment','connectedHostCount']:
        if isinstance(cur, dict) and k in cur: cur=cur[k]
        else: cur=None; break
    print(f'-- {p.name} --')
    if cur is None:
        print('missing')
    elif isinstance(cur, dict):
        print(json.dumps(cur, ensure_ascii=False, indent=2))
    else:
        print(repr(cur))
PY

Repository: stablyai/orca

Length of output: 19669


🌐 Web query:

i18next plural selection _one _other _few _many CLDR rules passing count option

💡 Result:

In i18next, pluralization is handled by passing a count option to the translation function (e.g., t('key', { count: N })) [1][2]. Since version 24, i18next mandates the use of the Intl.PluralRules API to determine which plural form to use based on the current language's rules [1][3]. CLDR Rules and Plural Categories i18next relies on the Unicode Common Locale Data Repository (CLDR) rules to categorize numbers into plural forms [4][5]. Depending on the target language, these forms may include zero, one, two, few, many, and other [1][4]. How it works: 1. When you pass the count option, i18next uses Intl.PluralRules to select the appropriate plural category for that number in the current language [1][5]. 2. It then appends the corresponding suffix (e.g., _one, _few, _many, _other) to your translation key [1][5]. 3. For example, in Polish, count: 1 resolves to the _one suffix, while count: 14 resolves to the _many suffix [5]. Crucial Implementation Details: - Mandatory Intl.PluralRules: If your environment (such as some versions of React Native) lacks native Intl.PluralRules support, you must use a polyfill [1][3]. Since v24, there is no built-in fallback to legacy plural handling; missing Intl support will result in errors and a failure to resolve complex plural forms [1][3]. - Complete Translation Sets: To ensure correct behavior, you must provide translations for all plural categories required by the target language's CLDR rules [5]. If you only define _one and _other for a language that requires _few or _many, i18next will fail to find the translation when the count falls into those categories [5]. - Automatic Management: It is highly recommended to use tools like i18next-parser or i18next-cli, which automatically generate the correct set of plural suffixes for your target languages based on CLDR standards, preventing manual errors in missing key definitions [5]. If you call the translation function without a count option (e.g., t('key')), i18next will not look for plural suffixes and will instead attempt to find the literal key 'key' [5]. If you have only defined pluralized keys in your JSON (e.g., key_one, key_other), the lookup will fail [5].

Citations:


🌐 Web query:

i18next missing plural suffixes fallback missing plural keys fallbackLng

💡 Result:

In i18next, plural keys are handled through language-specific plural suffixes (e.g., _one, _other) determined by the Intl.PluralRules API [1][2]. If a translation for a specific plural key is missing, i18next does not automatically fallback to a singular form or a different plural form [1][3]. Instead, it follows a standard resolution order: 1. Language Fallback: i18next attempts to find the translation in the configured fallback language(s) defined by the fallbackLng option [4][5]. 2. Key Fallback: If no translation is found in the current or fallback languages, and you have provided fallback keys (e.g., passing an array to the t function), i18next will attempt to resolve those keys [4][6][7]. 3. Key Itself: If no translation is found after these steps, i18next returns the key itself as the default fallback value [4][6]. Important Considerations: - Requirement of 'count': You must provide the count option (e.g., {count: 1}) to trigger pluralization [1][2]. If count is missing, i18next will not use plural logic and will not fallback to a plural form [1][2]. - Default Values: You can provide default plural forms using defaultValue and defaultValue_other (or other relevant suffixes) in the t function options [8][7]. - Missing Keys: If you want to identify missing translations during development, you should enable the saveMissing configuration option, which allows backends to collect these keys [6]. - Intl.PluralRules: Since i18next v24, the library relies on the native Intl.PluralRules API [1][9]. In environments without this (or without a polyfill), only English-style _one/_other suffixes will be supported, and no automatic fallback to other plural forms occurs [1][9].

Citations:


🌐 Web query:

site:i18next.com/how-to/pluralization fallback missing plural keys key separator _ plural suffix

💡 Result:

Relevant i18next documentation:

  • Pluralization: plural keys require count; i18next selects suffixes such as _one, _other, or _zero. There is no fallback to the base key when count is omitted. (i18next.com)
  • Missing plural keys: i18next resolves keys through plural/context variants, then fallback languages and namespaces. (i18next.com)
  • Plural suffixes and separator: modern v4 uses Intl-style suffixes; the default plural separator is _. Older environments may fall back to v3 handling if Intl.PluralRules is unavailable. (i18next.com)
  • Key separator: keySeparator controls nested-key parsing; set it to false when keys containing dots should be treated literally. (i18next.com)

Citations:


🌐 Web query:

i18next fallbackLng plural missing plural key fallbackLng same namespace behavior

💡 Result:

In i18next, when a specific plural key is missing, the fallback mechanism—whether through fallbackLng or fallbackNS—follows a defined resolution process to locate the most relevant translation [1][2]. 1. Plural Keys and Fallbacks When you use a plural key (e.g., key with a count option), i18next first attempts to find the specific plural form (e.g., key_one, key_other) for the current language and namespace [1][3]. If it is not found, i18next performs a hierarchical lookup [1]: - First, it searches for similar keys, prioritizing matches for the plural, context, and singular forms in order [1]. - If still not found, it traverses the defined fallbackLng list [1]. - If the key is still missing, it proceeds to the fallbackNS list [1][4]. - If no translation is found through these fallbacks, i18next returns the key itself (or a configured fallback key) [1][2]. 2. Important Constraints on Plurals - Missing count: The count variable is mandatory for pluralization [3]. If count is missing, i18next will not trigger plural logic and will not fallback to the pluralized versions of the key [3]. - Default Values: You can provide default plural forms using the defaultValue option with suffixes matching your pluralRules (e.g., defaultValue: 'one item', defaultValue_other: '{{ count }} items') [5][6]. If the primary key is missing, i18next will use these defaults [5]. - No Implicit Fallback for Missing Plural Logic: Be aware that if your environment lacks Intl.PluralRules support (and no polyfill is present), i18next may not resolve complex plural forms correctly, potentially failing to reach expected fallbacks [3]. 3. Namespace Behavior When fallbackNS is configured, i18next looks for the key in your primary namespaces before attempting the fallback namespace [4]. Note that the lookup order is hierarchical: i18next generally tries to resolve the key fully within the current language before moving to the next language in the fallback chain, searching through all specified namespaces at each language step [1][7]. For robust development, ensure saveMissing is enabled during development to identify and capture these missing keys in your backend, preventing runtime resolution issues [2][8].

Citations:


🌐 Web query:

i18next fallback missing plural key plural separator underscore same namespace fallbackLng

💡 Result:

In i18next, when a translation key is missing, the system follows a specific resolution order to find a fallback [1]. If a key is not found in the current namespace and language, i18next attempts to resolve it through fallback languages (fallbackLng) and fallback namespaces (fallbackNS) [2][3][4]. Regarding your specific configuration concerns: 1. Plural Separator: The default character used to split plural suffixes from a key is an underscore (_) [3][5]. You can modify this by setting the pluralSeparator option in your i18next configuration [3][6]. 2. Fallback Behavior for Missing Keys: - If a key is missing even after checking fallbacks, i18next returns the key itself by default [1]. - To handle missing keys systematically during development, you can enable saveMissing: true [2][7]. This allows you to collect missing keys via a backend or the missingKey event [2][7]. - If you want a specific string to be returned instead of the key when a translation is missing, you should provide a defaultValue in your t() function call [8]. 3. Namespaces: When a key is not found in the primary namespace, i18next will look for it in the configured fallbackNS if one is defined [3][1]. 4. Important Note on Plurals: If you provide a count to the t() function, i18next expects the corresponding plural form (e.g., key_one, key_other) to exist [9][10]. If the specific plural form is missing and cannot be resolved through your fallback configuration, it will not automatically fall back to the singular key; you must ensure the necessary plural forms are present in your translation files or provided as defaults [9][10]. If you find that your keys are appearing as raw text in your UI, it typically indicates that the translation is missing from all resolved sources (current language/namespace and fallback language/namespace) [2]. Using saveMissing is the recommended practice for identifying and fixing these gaps [2].

Citations:


Use i18next plural selection for host counts.

count === 1 selects only _one and _other, so CLDR plural forms such as _few or _many cannot render. Pass the unsuffixed key with { count }, and ensure language packs register their declared locale.

Proposed fix
 export function connectedHostCountLabel(count: number): string {
-  return count === 1
-    ? translate(
-        'auto.components.status.bar.SshStatusSegment.connectedHostCount_one',
-        '{{count}} host',
-        { count }
-      )
-    : translate(
-        'auto.components.status.bar.SshStatusSegment.connectedHostCount_other',
-        '{{count}} hosts',
-        { count }
-      )
+  return translate(
+    'auto.components.status.bar.SshStatusSegment.connectedHostCount',
+    '{{count}} hosts',
+    { count }
+  )
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function connectedHostCountLabel(count: number): string {
return count === 1
? translate(
'auto.components.status.bar.SshStatusSegment.connectedHostCount_one',
'{{count}} host',
{ count }
)
: translate(
'auto.components.status.bar.SshStatusSegment.connectedHostCount_other',
'{{count}} hosts',
{ count }
)
}
export function connectedHostCountLabel(count: number): string {
return translate(
'auto.components.status.bar.SshStatusSegment.connectedHostCount',
'{{count}} hosts',
{ count }
)
}

Source: Learnings

Comment on lines +2372 to +2376
? translate(
'auto.components.status.bar.StatusBar.floatingTerminalNewActivity',
'{{label}}, new activity',
{ label: floatingTerminalActionLabel }
)

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Localize floatingTerminalActionLabel before interpolating it.

floatingTerminalActionLabel is set directly from the hardcoded English literals 'Minimize Floating Workspace' and 'Show Floating Workspace' (unchanged, lines 2154-2156). This translated template interpolates that value as {{label}}. For any non-English locale, the resulting aria-label mixes the English label with the translated ", new activity" suffix.

Localize floatingTerminalActionLabel itself, then pass the localized value into this translate() call. Also update the plain usage at line 2395, which renders the same unlocalized variable directly in TooltipContent.

🌐 Proposed fix
-  const floatingTerminalActionLabel = floatingTerminalOpen
-    ? 'Minimize Floating Workspace'
-    : 'Show Floating Workspace'
+  const floatingTerminalActionLabel = floatingTerminalOpen
+    ? translate(
+        'auto.components.status.bar.StatusBar.minimizeFloatingWorkspace',
+        'Minimize Floating Workspace'
+      )
+    : translate(
+        'auto.components.status.bar.StatusBar.showFloatingWorkspace',
+        'Show Floating Workspace'
+      )

"0f116999f1": "Reinicia tu shell o agrega el directorio de Orca CLI a PATH antes de la configuración.",
"15cbedc3e3": "Instala la CLI de Orca antes de configurar skills para agentes.",
"windowsPathUnknown": "Orca could not check your Windows user PATH"
"windowsPathUnknown": "Orca could not check your Windows user PATH",

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== file exists and line count =="
wc -l src/renderer/src/i18n/locales/es.json

echo "== relevant lines =="
sed -n '344,358p;5644,5660p' src/renderer/src/i18n/locales/es.json

echo "== all windowsPathUnknown occurrences across locale files =="
python3 - <<'PY'
import json
from pathlib import Path
for p in sorted(Path("src/renderer/src/i18n/locales").glob("*.json")):
    try:
        data=json.load(open(p, encoding="utf-8"))
    except Exception as e:
        print(f"{p}: JSON parse error {e}")
        continue
    matches=[]
    def walk(obj, path):
        if isinstance(obj, dict):
            for k,v in obj.items():
                if k=="windowsPathUnknown" and isinstance(v,str) and v.startswith("WSL") or k=="windowsPathUnknown" and isinstance(v,str) and v.startswith("Orca"):
                    matches.append((path,k,v))
                walk(v, path+(k,))
        elif isinstance(obj,list):
            for i,v in enumerate(obj):
                walk(v, path+(str(i),))
    walk(data, ())
    if matches:
        print(f"\n{p}")
        for m in matches:
            print(f"  {'.'.join(m[:2])}: {m[2]}")
PY

echo "== search workflow references for i18n/fallback/catalog =="
rg -n "locales|i18n|locales/.*/es\.json|fallback|Translation|translate|locales" -S . --glob '!node_modules' --glob '!dist' --glob '!build' | head -200

Repository: stablyai/orca

Length of output: 2553


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== exact context around problematic entries =="
printf '\n--- src/renderer/src/i18n/locales/es.json:340-356 ---\n'
sed -n '340,356p' src/renderer/src/i18n/locales/es.json

printf '\n--- src/renderer/src/i18n/locales/es.json:5640-5656 ---\n'
sed -n '5640,5656p' src/renderer/src/i18n/locales/es.json

printf '\n--- en.json windowsPathUnknown ---\n'
python3 - <<'PY'
import json
from pathlib import Path
for p in sorted(Path("src/renderer/src/i18n/locales").glob("*.json")):
    try:
        data=json.load(open(p, encoding="utf-8"))
    except Exception as e:
        print(f"{p}: JSON parse error {e}")
        continue
    def walk(obj, path):
        if isinstance(obj, dict):
            for k,v in obj.items():
                if k == "windowsPathUnknown" and isinstance(v, str):
                    print(f"{p}:{'.'.join(path)}:{v}")
                walk(v, path+(k,))
        elif isinstance(obj, list):
            for i,v in enumerate(obj):
                walk(v, path+(str(i),))
    walk(data, ())
PY

echo "== i18n locale generation/workflow references =="
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  "generate.*locale|i18n|locales/.*/[^/]+\.json|fallback|en\.json|wsI18n|translateMessage|i18next|i18n" \
  -S .

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import json
from pathlib import Path

for loc in ["en", "es", "ja", "ko"]:
    p = Path(f"src/renderer/src/i18n/locales/{loc}.json")
    data = json.loads(p.read_text(encoding="utf-8"))
    hits = []
    def walk(obj, keypath):
        if isinstance(obj, dict) and "windowsPathUnknown" in obj and isinstance(obj["windowsPathUnknown"], str):
            hits.append((keypath + ["windowsPathUnknown"], obj["windowsPathUnknown"]))
        if isinstance(obj, dict):
            for k, v in obj.items():
                walk(v, keypath + [k])
        elif isinstance(obj, list):
            for i, v in enumerate(obj):
                walk(v, keypath + [i])
    walk(data, [])
    print(f"\n{loc}.json ({len(hits)} windowsPathUnknown)")
    for keypath, value in hits:
        print(f"  {'.'.join(str(p) for p in keypath)}: {value[:120]}")
PY

echo "== locate localized-catalog =="
fd -a 'localized-catalog\.(ts|tsx|js)$|locales' src/renderer/src/i18n 2>/dev/null || true
sed -n '1,220p' src/renderer/src/i18n/localized-catalog.ts

Repository: stablyai/orca

Length of output: 1960


Localize the missing Spanish fallbacks.

windowsPathUnknown is still English in both Spanish locale entries:

  • src/renderer/src/i18n/locales/es.json#L352-L352: Orca CLI Windows user PATH fallback.
  • src/renderer/src/i18n/locales/es.json#L5652-L5652: WSL CLI PATH fallback.

Translate these entries before merge.

📍 Affects 1 file
  • src/renderer/src/i18n/locales/es.json#L352-L352 (this comment)
  • src/renderer/src/i18n/locales/es.json#L5652-L5652

Source: Learnings

"0f116999f1": "セットアップ前にシェルを再起動するか、Orca CLI ディレクトリを PATH に追加します。",
"15cbedc3e3": "agent スキル セットアップを実行する前に、Orca CLI をインストールします。",
"windowsPathUnknown": "Orca could not check your Windows user PATH"
"windowsPathUnknown": "Orca could not check your Windows user PATH",

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files matching ja.json:"
fd -a 'ja\.json$' . | sed 's#^\./##'

echo
echo "Relevant ja.json entries:"
python3 - <<'PY'
import json
from pathlib import Path
p=Path('src/renderer/src/i18n/locales/ja.json')
data=json.load(open(p, encoding='utf-8'))
print('root keys:', list(data.keys())[:5])
def walk(obj, path=''):
    if isinstance(obj, dict):
        for k,v in sorted(obj.items()):
            p=path+'.'+k if path else k
            if k in {'windowsPathUnknown'} or isinstance(v, str) and ('windowsPathUnknown' in v or 'Orca could not check' in v or 'Path check failed' in v):
                print(p, repr(v))
            walk(v, p)
walk(data)
PY

echo
echo "Exact context around ja.json lines 348-356 and 5633-5641:"
sed -n '348,356p;5633,5641p' src/renderer/src/i18n/locales/ja.json | cat -n

echo
echo "Search for i18n usage of windowsPathUnknown:"
rg -n '"windowsPathUnknown"|windowsPathUnknown|Path check failed|Path check failed' -S .

Repository: stablyai/orca

Length of output: 3195


Translate the English PATH-status strings in ja.json.

ja.json currently uses English source text for windowsPathUnknown at lines 352 and 5637, while adjacent entries and other locale catalogs contain local translations. Replace them with Japanese values so Japanese users do not see fallback English strings.

"0f116999f1": "설정하기 전에 셸을 다시 시작하거나 Orca CLI 디렉터리를 PATH에 추가하세요.",
"15cbedc3e3": "agent 스킬 설정을 실행하기 전에 Orca CLI를 설치하십시오.",
"windowsPathUnknown": "Orca could not check your Windows user PATH"
"windowsPathUnknown": "Orca could not check your Windows user PATH",

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Translate both PATH error values in the Korean catalog.

These entries override the Korean UI with English text for two failure states.

  • src/renderer/src/i18n/locales/ko.json#L352-L352: Translate the Windows user PATH error.
  • src/renderer/src/i18n/locales/ko.json#L5637-L5637: Translate the WSL shell command PATH error.
📍 Affects 1 file
  • src/renderer/src/i18n/locales/ko.json#L352-L352 (this comment)
  • src/renderer/src/i18n/locales/ko.json#L5637-L5637

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…e-host count (stablyai#12478)

* fix(i18n): localize the status bar Resource Manager tooltip and remote-host count

The Resource Manager tooltip/aria label and the SSH segment's host count were
assembled from bare English literals inside helper functions, so they stayed
English under every non-English UI language while the labels around them
translated. Route them through the catalog with _one/_other plural keys and
whole-line messages (locales reorder and repunctuate the summary), and add
en/es/ja/ko/zh entries.

Root cause of the miss: audit-localization-coverage bailed on any ancestor
binary expression whose operator was not `+`, which hid every string under a
`cond && <JSX/>` guard or a `?? 'fallback'` — including this segment's
'Connecting…'. Only comparison operands are code, so keep `??`, `||` and
`&&` walking, and localize the four real strings that surfaced.

Co-authored-by: Orca <[email protected]>

* fix(status-bar): flag the space-scan tooltip row instead of matching its English text

The tooltip tinted a row with `line === 'Space scan ready'`, so routing that
copy through the catalog silently dropped the tint in every translated build.
Return `{ text, emphasized }` and let the segment read the flag.

Adopted from stablyai#12439 by @smwbev.

Co-authored-by: Evgenii <[email protected]>

Co-authored-by: Orca <[email protected]>

* fix(status-bar): key Resource Manager tooltip rows by role instead of array index

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Orca <[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