Skip to content

icu-plural-forms ​

Warning · An ICU plural does not have the forms of its language.

git8n check reports this rule as a warning. It fails only past --max-warnings.

Why it matters ​

An ICU plural picks a branch by the plural rules of the language. A form that the translation does not write shows the text of other, so a Polish « 5 elementów » becomes « 5 elementy ». A form that the language never uses is text that nobody reads.

Invalid ​

locales/en/common.json

json
{
  "items": "{count, plural, one {# item} other {# items}}"
}

locales/pl/common.json

json
{
  "items": "{count, plural, one {# element} other {# elementu}}"
}
text
$ git8n check --source en
locales/pl/common.json
  warning  common:items: the plural {count} has no few many.  icu-plural-forms

Read more:
  icu-plural-forms  https://git8n.sakuga.dev/docs/reference/rules/icu-plural-forms.html

0 errors, 1 warning in 2 files (en → pl, 1 key).

Valid ​

locales/en/common.json

json
{
  "items": "{count, plural, one {# item} other {# items}}"
}

locales/pl/common.json

json
{
  "items": "{count, plural, one {# element} few {# elementy} many {# elementów} other {# elementu}}"
}

locales/fr/common.json

json
{
  "items": "{count, plural, =0 {aucun article} =1 {# article} other {# articles}}"
}
text
$ git8n check --source en
0 errors, 0 warnings in 3 files (en → fr, pl, 1 key).

What to do ​

Write a branch for each form of the language, and delete the others. Polish needs one, few, many and other; Japanese needs other only. An exact branch such as =0 is always allowed, and exact branches that hold all the numbers of a form replace it: =1 replaces one in English, but not in French, where one is 0 and 1. A form that only a number past 9999 takes, such as the many of French, is allowed and not needed.

All the rules · The command check