You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(i18n): resolve count strings with each language's plural rules - #34693
translate() in src/renderer/src/i18n/i18n.ts handles keys with a plural suffix. When a call names a literal …_one/…_other key and passes a numeric count, it drops the suffix and resolves the plural family. i18next then picks the CLDR form for the active language. For a plugin pack, that is the language the pack declares, so a pack's _few/_many forms are now used. If a pack has no entry for a category, _other is used, as before. Keys, extraction, call-site shapes and the verify tooling don't change.
Built-in catalogs now go through the existing withPluralCategoriesFromOther when they load. CLDR categories they lack (es/fr/pt many) are filled from _other. Before this, very large counts fell back to English.
Twelve _one strings hardcoded "1": theme import, workspace batch labels, worktree hiding, dirty-change hint, setup skipped fields and Computer Use permissions. They now interpolate the count placeholder the family's _other already uses, in all 7 catalogs. The related calls that didn't pass count now do. fullCoverage_one keeps its wording. Its es/fr/pt translations say "the only agent" and have no number. It's only reachable when the count is exactly 1.
en-runtime-required.json was regenerated. Only those values changed.
I added one case to plugin-pack-plurals.test.ts: a literal _one/_other call site in a ru pack renders one/few/many.
Visible changes
English output is unchanged. I checked counts 0, 1, 2 and 1e6.
fr and pt now treat 0 as singular, as CLDR does, e.g. "0 hôte" instead of "0 hôtes".
es, fr and pt counts in the CLDR many range now stay in their language instead of falling back to English.
Not in this PR
About 156 ternaries pick between two unrelated keys, either hashed or Singular/Plural. They still choose the form in JS. Converting them means renaming keys, which invalidates existing pack translations. That is held as a follow-up, along with the plugin rework. The main-process translateMain (1 plural site) is unchanged.
Validation
verify:localization-catalogs, verify:localization-extraction, verify:localization-coverage and verify:localization-runtime-catalog pass.
tc:web passes.
pnpm test src/renderer/src/i18n passes, along with the component tests for the touched files.
translate() now resolves a literal _one/_other key passed a numeric count
through its plural family, so i18next picks the CLDR form for the active
language or plugin pack. Built-in catalogs fill missing plural categories
(e.g. many in es/fr/pt) from _other so large counts stay in-language.
_one strings that hardcoded 1 now interpolate the count.
Closes#12106
No actionable comments were generated in the recent review.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 7c598f1f-2596-481f-8a49-81108e0e14cc
Commits
Reviewing files that changed from the base of the PR and between b6ca0cd and 98431c1.
Files selected for processing: 8
src/renderer/src/i18n/en-runtime-required.json
src/renderer/src/i18n/locales/en.json
src/renderer/src/i18n/locales/es.json
src/renderer/src/i18n/locales/fr.json
src/renderer/src/i18n/locales/ja.json
src/renderer/src/i18n/locales/ko.json
src/renderer/src/i18n/locales/pt.json
src/renderer/src/i18n/locales/zh.json
Files skipped from review as they are similar to previous changes: 7
src/renderer/src/i18n/locales/en.json
src/renderer/src/i18n/locales/es.json
src/renderer/src/i18n/locales/zh.json
src/renderer/src/i18n/locales/pt.json
src/renderer/src/i18n/locales/fr.json
src/renderer/src/i18n/locales/ko.json
src/renderer/src/i18n/locales/ja.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Walkthrough
The translation loader now receives the locale and fills missing plural categories from each catalog key’s _other value. The translation function normalizes plural-suffixed keys when a numeric count is supplied. Renderer call sites now pass counts, and singular messages in runtime-required and locale catalogs interpolate those counts. A test checks plural selection for Russian plugin translations.
Priority: Normal
Severity of issue fixed: Medium
Merge Risk: Minimal · up to 98431
Plural selection and count interpolation are consistent across the changed renderer paths and catalogs, with no merge-blocking risk identified.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 6.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: applying each language's plural rules to count-string resolution.
Description check
The description is detailed and covers the change, rationale, linked issue, visible behavior, scope limits, and validation results. It omits several template sections, including ELI5, Visual Proof or …
Linked Issues check
Issue #12106 requires renderer plural selection through i18next and correct rules for plugin pack locales. translate() removes a literal plural suffix when count is numeric. The changed renderer c…
Out of Scope Changes check
The changed call sites, catalog updates, plural-category fallback, runtime catalog, and plugin test support Issue #12106. The count interpolation changes prevent hard-coded singular values from blocki…
Full details: Description check
Explanation
The description is detailed and covers the change, rationale, linked issue, visible behavior, scope limits, and validation results. It omits several template sections, including ELI5, Visual Proof or an explicit N/A, Review, Agent skill upstream boundary, Notes, and the Checklist, but the core PR information is complete.
Full details: Linked Issues check
Explanation
Issue #12106 requires renderer plural selection through i18next and correct rules for plugin pack locales. translate() removes a literal plural suffix when count is numeric. The changed renderer call sites pass count. pluralResolver.getRule maps synthetic plugin resource languages to the declared locale. The plugin test verifies Russian one, few, and many forms, including literal suffixed keys. Catalog loading fills missing categories from _other. These changes address the stated coding requirements. The issue does not require the documented unrelated-key ternaries or unchanged translateMain sites.
Full details: Out of Scope Changes check
Explanation
The changed call sites, catalog updates, plural-category fallback, runtime catalog, and plugin test support Issue #12106. The count interpolation changes prevent hard-coded singular values from blocking localized plural output. No unrelated change is demonstrated by the reviewed summary or inspected files.
Full details: Docstring Coverage
Explanation
Docstring coverage is 6.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 16 functions across 11 files. (8 skipped: 8 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
For a Japanese plugin pack, Intl.PluralRules('ja') selects other, including for count: 1. translate() removes the literal _one suffix before calling i18next, so i18next requests deleteCount_other. The normalizer only fills missing categories from an existing _other value. A pack containing only deleteCount_one therefore skips the existing plugin translation and can return the English fallback.
Preserve the original literal-key translation when the selected category is absent from the active plugin pack. Packs that contain both _one and _other remain covered by the existing _other backfill.
Minor · Functional Correctness · Quick win
Supported by static analysis
Script executed:
rg -n "deleteWorkspacesCountLabel|deleteCount_one|deleteCount_other|plugin.*language|language.*pack|count:" src/renderer/src/i18n src/renderer/src/components src/shared/plugins
sed -n '85,115p' src/renderer/src/i18n/i18n.ts
sed -n '1,180p' src/shared/plugins/plugin-language-pack-artifact.ts
A legacy plugin catalog can contain a hardcoded 1 in _one. For a count of 21, deleteWorkspacesCountLabel calls translate with _other, translate strips the suffix, and the Russian plural rule selects that catalog’s _one entry. The result can display 1 instead of 21.
Built-in catalog changes do not update installed plugin catalogs. Do not unconditionally fall back to _other: for Russian, 21 correctly selects _one, and replacing it with _other can violate the pack’s plural contract. Add compatibility handling for legacy entries that do not interpolate the supplied count while preserving the locale’s selected plural category.
* feat(i18n): add Russian UI language
Register `ru` as a built-in UI language using the catalog from #33370,
reconciled against current en.json: keys pruned from English were dropped,
stale translations whose English source changed were removed, and the
catalog verifier now accepts CLDR few/many forms for an existing `_other`
family.
Co-authored-by: Vyacheslav Scherbinin <[email protected]>
* fix(i18n): drop Russian _one entries superseded by count placeholders
Main now interpolates the count in English _one strings (#34693), so the
literal-1 Russian forms no longer match their source.
* feat(i18n): complete Russian catalog and add terminology glossary
Translate the 650 remaining English keys and the few/many plural forms for
every count family, and document the Russian glossary and style conventions.
* fix(i18n): apply reviewed Russian translation corrections
Fix mistranslations and grammar flagged in a full-catalog review, and align
terminology with the glossary: рабочее дерево for worktree, рабочее
пространство for workspace, пул-реквест and файлы cookie.
* fix(i18n): resolve Russian plural forms in main-process strings and align ru terminology
translateMain now resolves literal _one/_other keys through the CLDR plural
family like translate(), so native dialogs pick Russian few/many forms. The
plural helpers move to src/shared for reuse. apply-translation-delta accepts
locale-only plural categories sourced from English _other. ru.json follows the
glossary for account/session/prompt and uses a single ellipsis character.
---------
Co-authored-by: OrcaWin <[email protected]>
Co-authored-by: Vyacheslav Scherbinin <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12106
What changed
translate()insrc/renderer/src/i18n/i18n.tshandles keys with a plural suffix. When a call names a literal…_one/…_otherkey and passes a numericcount, it drops the suffix and resolves the plural family. i18next then picks the CLDR form for the active language. For a plugin pack, that is the language the pack declares, so a pack's_few/_manyforms are now used. If a pack has no entry for a category,_otheris used, as before. Keys, extraction, call-site shapes and the verify tooling don't change.withPluralCategoriesFromOtherwhen they load. CLDR categories they lack (es/fr/ptmany) are filled from_other. Before this, very large counts fell back to English._onestrings hardcoded "1": theme import, workspace batch labels, worktree hiding, dirty-change hint, setup skipped fields and Computer Use permissions. They now interpolate the count placeholder the family's_otheralready uses, in all 7 catalogs. The related calls that didn't passcountnow do.fullCoverage_onekeeps its wording. Its es/fr/pt translations say "the only agent" and have no number. It's only reachable when the count is exactly 1.en-runtime-required.jsonwas regenerated. Only those values changed.plugin-pack-plurals.test.ts: a literal_one/_othercall site in a ru pack renders one/few/many.Visible changes
manyrange now stay in their language instead of falling back to English.Not in this PR
About 156 ternaries pick between two unrelated keys, either hashed or
Singular/Plural. They still choose the form in JS. Converting them means renaming keys, which invalidates existing pack translations. That is held as a follow-up, along with the plugin rework. The main-processtranslateMain(1 plural site) is unchanged.Validation
verify:localization-catalogs,verify:localization-extraction,verify:localization-coverageandverify:localization-runtime-catalogpass.tc:webpasses.pnpm test src/renderer/src/i18npasses, along with the component tests for the touched files.