Lesson 4 of 9 · 27m
Plural Rules and Grammatical Agreement
Use CLDR plural categories and complete-message grammar instead of English-centric one/other assumptions.
English trains developers to believe pluralization is binary: one item, many items. That belief breaks before breakfast. Russian distinguishes forms for 1, 2-4, and most larger counts depending on the final digits. Arabic has zero, one, two, few, many, and other categories. Polish, Czech, Welsh, and Slovenian bring their own rules. Pluralization is grammar, not an if count == 1 branch.
CLDR categories are the abstraction
Unicode CLDR defines plural categories such as zero, one, two, few, many, and other. Not every language uses every category. Russian exposes the difference directly:
{count, plural, one {# элемент} few {# элемента} many {# элементов} other {# элемента}}other is mandatory because it is the catch-all category. It does not necessarily mean plural in the English sense; in some languages it serves fractions or edge cases.
Plural selection depends on the number and locale
The same integer can select different categories in different locales. Even within one language, fractions can behave differently from integers. Do not implement digit-ending rules yourself; use ICU or a well-maintained platform binding:
new Intl.PluralRules("ru").select(21); // "one"
new Intl.PluralRules("ru").select(22); // "few"
new Intl.PluralRules("ru").select(25); // "many"
new Intl.PluralRules("ru").select(1.5); // "other"Zero is not always special
English usually treats zero like plural: 0 messages. Arabic has a true zero category. Even where the grammar has a zero form, product voice may prefer a separate empty state. That is a content design decision; do not hide it inside plural syntax accidentally.
{count, plural,
zero {لا توجد رسائل}
one {رسالة واحدة}
two {رسالتان}
few {# رسائل}
many {# رسالة}
other {# رسالة}
}Gender and agreement need complete sentences
Languages with grammatical gender may require different forms for user names, roles, or objects. ICU select can represent explicit agreement when the data exists:
{gender, select,
feminine {Bienvenida, {name}}
masculine {Bienvenido, {name}}
other {Te damos la bienvenida, {name}}
}Do not collect gender merely for grammar unless product design and privacy requirements justify it. Sometimes rephrasing avoids agreement altogether; when count affects noun, verb, adjective, or pronoun, keep the whole sentence inside the plural message.
Field notes
#inserts the formatted number in ICU plural messages; decide whether digit formatting should be locale-aware before writing the message.- Plural rules use the numeric value, not the formatted string. Pass a number, not
"1,234". - Some languages use
fewormanyin ways developers find counterintuitive. Trust CLDR data and native review over intuition. - A translator cannot add a missing category if your toolchain validates only English categories. Configure locale-aware validation.
Was this lesson helpful?