Course contentsShow
← JavaScript
Lesson 1659 of 2,72335. Standard Library and Built-insFree lesson

Intl.PluralRules Overview

Learn how PluralRules helps determine plural categories (one, few, many, other) for correct localized grammar.

Intl.PluralRules Overview

You'll learn how Intl.PluralRules automatically determines whether a number should be treated as "one," "few," "many," or "other" in different languages—critical for grammatically correct localized text.

The Grammar Problem Across Languages

Different languages have wildly different plural rules. In English, you say "1 item" but "2 items"—a simple switch at the boundary of one. But Polish uses different forms for 2-4 items versus 5+ items. Arabic has separate forms for zero, one, two, a "few," "many," and "other." Writing hardcoded if statements for each language would be a nightmare.

Intl.PluralRules solves this by encapsulating the Unicode CLDR plural rules for every locale. You give it a number, and it tells you which grammatical category that number falls into for a specific language.

What It Returns

The .select() method returns one of these category strings:

  • "zero" (used in Arabic, for example)
  • "one" (singular)
  • "two" (dual forms in some languages)
  • "few" (small quantities in Slavic languages)
  • "many" (larger quantities or specific ranges)
  • "other" (the default/fallback)

The Analogy

Think of PluralRules as a multilingual grammar consultant. Instead of you learning every language's plural quirks, you ask: "In Russian, is 5 considered 'few' or 'many'?" and it instantly knows the answer based on centuries of linguistic rules.

Why This Matters

Without this API, you'd write: count === 1 ? "item" : "items". But that breaks in Polish, Arabic, Welsh, and dozens of other languages. PluralRules gives you the category; you provide the appropriate translations for each category.

Key Takeaway: Intl.PluralRules determines the correct plural category for any number in any locale, ensuring your app's grammar adapts naturally to every language without hardcoding plural logic.