i18n-report: check plural branches against each locale's CLDR categories

Author: janduboisCreated Sep 22, 2026Updated Sep 22, 2026
Labelskind/enhancementarea/localization

i18n-report validate requires each plural construct in a locale to have exactly the branch labels of the en-us construct, usually one and other. Vietnamese, Japanese, Korean and Chinese select only other, so their files have a one branch that never shows. Russian, Polish and Ukrainian need few and many, which the check rejects, so those locales can't be added with correct plurals.

  • In src/go/i18n-report/report_validate.go, check a locale's plural branch labels against that locale's CLDR cardinal categories instead of en-us's labels, passing the locale down from validateLocale to compareBranchLabels. The new check should:
    • require other;
    • allow leaving out an en-us branch whose category the locale doesn't have;
    • allow a category the locale has and English doesn't;
    • keep matching =N branches and select constructs against en-us exactly.
  • Take the categories from CLDR data that agrees with Intl.PluralRules, which the app formats with: a table of the shipped locales, or golang.org/x/text/feature/plural, a new dependency.
  • Collapse the identical one/other branches in ja.yaml, ko.yaml, zh-hans.yaml and vi.yaml (three delete-confirmation messages each), and drop the @reason notes that explain them.
  • Add a plural section to pkg/rancher-desktop/assets/translations/README.md. It should say that zero, one, two, few, many and other are keywords, that only the text in braces is shown, and that each locale uses its own categories.

Decide before starting whether a locale must include every category it has. Requiring few in Russian catches a real mistake, but French, Spanish, Italian and Brazilian Portuguese would each need a many branch that shows only for exact multiples of a million. Also decide whether a branch for a category the locale lacks, like one in Japanese, is an error, and whether a locale that has only other may drop the construct entirely, as in 删除 {count} 个卷?.

Background

CLDR cardinal categories, from new Intl.PluralRules(locale).resolvedOptions().pluralCategories in Node:

Locales Categories
en, de one, other
vi, ja, ko, zh, zh-Hant, id other
ru, pl, uk one, few, many, other
it, fr, es, pt-BR one, many, other

The exact match is deliberate. The comment on checkICUStructure says a dropped or renamed branch should count as an error, and that the plural case should be relaxed once a locale whose categories differ from English's is added. Vietnamese, Japanese, Korean and Chinese already are such locales; they pass only because they keep the one branch. Whatever replaces the check still has to catch a branch dropped by accident.

The collapse and the README gap both came up in #10957.

Italian and German each have one message whose branches read the same (the loanwords container and Container). Both languages select one for 1, so those constructs stay under any of these rules.

Source: rancher-sandbox/rancher-desktop