Chapter 04·Common UI Defects·~10 min·
Plural Rules, Ordinals, and Grammatical Gender
CLDR defines six plural categories: zero, one, two, few, many, and other. Each language uses a subset of these categories to select grammatical noun and verb forms at runtime.
Overview
Checking whether a count equals 1 fails in languages with more than two plural forms. Plural selection depends on language-specific grammatical categories defined in CLDR. ICU MessageFormat and `Intl.PluralRules` select the required form at runtime.
Core rule
Resolve grammatical plural categories at runtime with Intl.PluralRules or ICU MessageFormat. Never hardcode count === 1 conditional branches.
Specification note: English uses two plural categories. Russian and Polish use four, Arabic and Welsh use all six, and Japanese uses one.
Failure mode
English uses two cardinal plural categories, Russian uses four, and Arabic uses six. Conditional expressions such as count === 1 ? "1 item" : `${count} items` fail whenever a target language diverges from English plural rules. French assigns 0 to the one category, while Russian assigns 21 to one and 5 to many.
Accurate pluralization requires coordination between translation catalogs and runtime code. Translators must supply one variant for each plural category in the target language. At runtime, the formatting engine evaluates the CLDR plural rule, selects the matching variant, and formats the interpolated number.
Pluralization across human languages cannot be solved with count === 1. Languages use up to six grammatical plural categories.
Business stakes & user risk
Phrases like '1 items' look unprofessional in English, but in languages like Russian or Arabic, wrong plural forms violate basic grammar rules and confuse users.
Rule of thumb
Use ICU MessageFormat or Intl.PluralRules. Never write binary count === 1 conditionals.
The Novice Trap vs. Production Standard
Contrast the intuitive assumption with the architecture required for global releases.
“Every language has two forms: singular for 1, and plural for everything else.”
Naive approach: Binary ternary check
const label = count === 1 ? "1 item" : count + " items";Defect:In Russian, 21 items becomes '21 items' (plural) instead of grammatically correct '21 товар' (singular category 'one').
English uses two plural forms, Russian uses four, and Arabic uses six. Russian uses the singular form for 21, 31, and 101, but the plural form for 5.
Production standard: ICU MessageFormat
{count, plural, one {# item} other {# items}}Benefit:Translators can supply the exact grammatical variations required by their language without altering application logic.
Cross-Functional Review Questions
Questions for product managers, designers, engineers, and testers to ask during sprint reviews.
“Are we utilizing an ICU MessageFormat library for dynamic counted strings?”
“Can our copy avoid compound sentences that mix multiple dynamic numbers in one sentence?”
“Are translators provided full sentence context and plural rules in translation files?”
“Do test suites evaluate boundary counts: 0, 1, 2, 5, 11, 21, and 100?”
Mechanism
CLDR plural categories and runtime resolution
CLDR defines six grammatical plural categories: zero, one, two, few, many, and other. Each language uses a specific subset of these categories. Chinese and Japanese use one (other), English and German use two (one, other), Russian and Polish use four (one, few, many, other), and Arabic and Welsh use all six.
At runtime, an ICU MessageFormat resolver evaluates a counted message in three steps. First, it checks for an explicit exact-value match such as =0 or =1. Second, if no exact match exists, it calls Intl.PluralRules(locale).select(count) to determine the CLDR category. In Russian, select(21) returns one and select(22) returns few. Third, it interpolates the formatted number in place of the # token inside the chosen branch.
Category names represent grammatical classes rather than single numbers. Only the other category is mandatory across all languages. ICU parsers reject any plural block that omits the other fallback branch.
{count, plural,
one {# файл}
few {# файла}
many {# файлов}
other {# файла}}Interactive demo
Guided exercises
- 1Select Russian and click the quick-jump count buttons 1, 21, and 22. Count 21 resolves to `one` alongside 1, while 22 resolves to `few` alongside 2. Russian plural categories follow the final digits except for the teen range 11–14, which always maps to `many`.
- 2With Russian selected, click the 1.5 quick-jump button. The category resolves to `other` (1,5 яблока) because Russian assigns non-integer fractions to the genitive singular form in `other`.
- 3Switch the language to Arabic (ar-SA) and step through 0, 1, 2, 3, 11, and 100. Arabic cycles through all six CLDR plural categories (`zero`, `one`, `two`, `few`, `many`, `other`), requiring six distinct message branches.
- 4Switch the mode to Ordinals and test counts 11, 12, 13, and then 21, 22, 23. In English, 11 through 13 map to `other` (-th), whereas 21, 22, and 23 map to `one` (-st), `two` (-nd), and `few` (-rd) via `Intl.PluralRules(locale, { type: 'ordinal' })`.
- 5Switch the mode to Gender and click female, male, and other / unknown. Each language updates its adjective or verb inflection to match the selected gender, using the mandatory `other` branch when gender is unspecified.
Language
Noun
Count
1 яблоко
Four forms: 1, 21, 31 are “one”; 2–4 are “few”; 5–20 are “many”; fractions are “other”.
ICU message source · Russian
How an i18n runtime resolves it
- 1 · input
count = 1n=1, locale=ru-RU - 2 · select category
new Intl.PluralRules("ru-RU").select(1)one - 3 · look up the branch
message[one]# яблоко - 4 · format #
new Intl.NumberFormat("ru-RU").format(1)1 - 5 · substitute & emit1 яблоко
count === 1 happens to be correct here▸ The same message in intl-messageformat
import { IntlMessageFormat } from "intl-messageformat";
const msg = new IntlMessageFormat(
"{n, plural, one {# яблоко} few {# яблока} many {# яблок} other {# яблока}}",
"ru-RU",
);
msg.format({ n: 1 });
// → "1 яблоко"Category map · Russian
Integers 0–29, colored by cardinal category. Click a cell to set the count.
One message, every language
count = 1Each row is that language's own translation of “apple / apples”. Click a row to focus it above.
| Language | Category | Resolved string | Forms used |
|---|---|---|---|
EnglishEnglish | one | 1 apple | oneother |
SpanishEspañol | one | 1 manzana | onemanyother |
FrenchFrançais | one | 1 pomme | onemanyother |
GermanDeutsch | one | 1 Apfel | oneother |
RussianРусский | one | 1 яблоко | onefewmanyother |
PolishPolski | one | 1 jabłko | onefewmanyother |
CzechČeština | one | 1 jablko | onefewmanyother |
Arabicالعربية | one | تفاحة واحدة | zeroonetwofewmanyother |
Chinese中文 | other | 1 个苹果 | other |
Japanese日本語 | other | 1個のリンゴ | other |
Korean한국어 | other | 사과 1개 | other |
Implementation rules
- Resolve plural categories with
Intl.PluralRulesor ICU MessageFormat. Map numeric counts to CLDR categories (zero,one,two,few,many,other). Remove allcount === 1ternary checks from application code. - Treat plural categories as grammatical classes. The
onecategory is not restricted to the number 1. In Russian, integers ending in 1 (except 11) map toone, integers ending in 2 through 4 (except 12 through 14) map tofew, and remaining integers map tomany. - Include the mandatory
otherfallback branch. Every ICUpluralandselectmessage requires anotherbranch to handle fractions and unmatched values. - Separate cardinal and ordinal rules. Use default cardinal rules for item counts and
new Intl.PluralRules(locale, { type: "ordinal" })for rankings such as 1st, 2nd, and 3rd. - Keep multi-variable sentences in a single message. Express sentences with multiple counts as one ICU message so translators can reorder clauses for target grammar.
Operational context
Roles
Workflow stages
- ·Authoring UI strings with dynamic counts
- ·Auditing message catalogs before translation
- ·Selecting an ICU MessageFormat runtime library
See it in a market: Russia · 4 cardinal plural categories →
Production incident
Replacing a hardcoded plural string with `count === 1 ? singular : plural` fixes English but breaks Slavic, Semitic, and Celtic languages. In Russian, integers ending in 1 (except 11) require the `one` form, integers ending in 2 through 4 (except 12 through 14) require `few`, and remaining integers require `many`.