Skip to content
Locale Lab

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.

Intl.PluralRulesICUMessageFormat

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.

Stakeholder Teaching Aid & Novice Guide
Cross-functional alignment tool

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.

Naive mental model

“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').

Production standard

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.

For EngineeringQuestion #1

“Are we utilizing an ICU MessageFormat library for dynamic counted strings?”

What to look for: Adoption of react-intl, formatjs, i18next-icu, or native Intl.PluralRules.
For DesignQuestion #2

“Can our copy avoid compound sentences that mix multiple dynamic numbers in one sentence?”

What to look for: UI copy designed as simple, independent clauses rather than nested numerical dependencies.
For ProductQuestion #3

“Are translators provided full sentence context and plural rules in translation files?”

What to look for: Translation keys exported with plural variants and descriptive notes explaining what is being counted.
For QAQuestion #4

“Do test suites evaluate boundary counts: 0, 1, 2, 5, 11, 21, and 100?”

What to look for: Automated tests validating non-English plural outputs for Slavic and Arabic locales.

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 {# файла}}
Russian ICU plural message with four grammatical categories.

Interactive demo

Guided exercises

  1. 1
    Select 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`.
  2. 2
    With 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`.
  3. 3
    Switch 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.
  4. 4
    Switch 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' })`.
  5. 5
    Switch 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

РусскийRussian
Resolved string
ru-RU·one

1 яблоко

Four forms: 1, 21, 31 are “one”; 2–4 are “few”; 5–20 are “many”; fractions are “other”.

ICU message source · Russian

{n, plural, one {# яблоко} few {# яблока} many {# яблок} other {# яблока} }

How an i18n runtime resolves it

  1. 1 · inputcount = 1
    n=1, locale=ru-RU
  2. 2 · select categorynew Intl.PluralRules("ru-RU").select(1)
    one
  3. 3 · look up the branchmessage[one]
    # яблоко
  4. 4 · format #new Intl.NumberFormat("ru-RU").format(1)
    1
  5. 5 · substitute & emit1 яблоко
count === 1 happens to be correct here
naive1 яблокоCLDR1 яблоко
▸ 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.

4 categories:onefewmanyother

One message, every language

count = 1

Each row is that language's own translation of “apple / apples”. Click a row to focus it above.

LanguageCategoryResolved stringForms used
EnglishEnglish
one1 apple
oneother
SpanishEspañol
one1 manzana
onemanyother
FrenchFrançais
one1 pomme
onemanyother
GermanDeutsch
one1 Apfel
oneother
RussianРусский
one1 яблоко
onefewmanyother
PolishPolski
one1 jabłko
onefewmanyother
CzechČeština
one1 jablko
onefewmanyother
Arabicالعربية
oneتفاحة واحدة
zeroonetwofewmanyother
Chinese中文
other1 个苹果
other
Japanese日本語
other1個のリンゴ
other
Korean한국어
other사과 1개
other

Implementation rules

  • Resolve plural categories with Intl.PluralRules or ICU MessageFormat. Map numeric counts to CLDR categories (zero, one, two, few, many, other). Remove all count === 1 ternary checks from application code.
  • Treat plural categories as grammatical classes. The one category is not restricted to the number 1. In Russian, integers ending in 1 (except 11) map to one, integers ending in 2 through 4 (except 12 through 14) map to few, and remaining integers map to many.
  • Include the mandatory other fallback branch. Every ICU plural and select message requires an other branch 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

EngineeringQALocalization

Workflow stages

  • ·Authoring UI strings with dynamic counts
  • ·Auditing message catalogs before translation
  • ·Selecting an ICU MessageFormat runtime library

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`.

CLDR Language Plural Rules chart ↗

Terms in this chapter

Further reading

Related chapters