Plural forms: what the check looks for and how to fix it
Plural categories by language, the check that finds a missing one in Android, iOS, web and Flutter resources, and how to fix it. Production-measured.
On this page
A plural message needs one form for each plural category its language has. English has two (one, other); French, Spanish and Portuguese have three (one, many, other); Japanese and Korean have one (other); Arabic has six. A message translated from English that keeps two forms is wrong in Arabic and incomplete in French, and nothing crashes: the app shows the wrong sentence for some numbers.
Categories by language
CLDR 45, copied into the threefold repository:
| Language | Categories |
|---|---|
| English, German | one, other |
| French, Spanish, Portuguese | one, many, other |
| Japanese, Korean | other |
| Arabic | zero, one, two, few, many, other |
The checks
| Check | What it looks for | Measured status |
|---|---|---|
CHK-CORE-005 | Plural translations that miss a category the target language needs, in any resource format | production |
CHK-AND-003 | Android <plurals> resources that miss a required quantity for the locale | production |
CHK-IOS-002 | Syntax of .strings and .stringsdict files, where iOS plural rules live | production |
"Production" means the check met the 90% precision and 90% recall bar on threefold's benchmark (how it is measured).
Run it
npx threefold check . --markets es-MX,fr-FR,ar-SA
If npx reports that the package does not exist, it has not been published yet: the i18n check page and the guides say what works meanwhile.
How to fix a finding
- Android: in
res/values-<locale>/strings.xml, give each<plurals>an<item quantity="...">for every category the language needs. - iOS: in the String Catalog, choose Vary by Plural for the string and fill each category Xcode shows for the language.
- Web and Flutter: write the message in ICU form with
plural,and a branch for every category, for example{count, plural, one {# día} many {# de días} other {# días}}.
What it cannot tell
It confirms that every category has a form. It does not judge whether the words in a form are right: have a speaker read the translation.
Guides by stack and language
Flutter plurals for German, Android plurals for Japanese, iOS plural resources.
Questions
Why does Spanish have a many category?
CLDR gives Spanish, French and Portuguese a many category for large round numbers such as one million. A message that never meets such a number still needs the form for the check to pass.
Does Japanese need a plural form?
It has one category, other, so one form is the whole answer.