Home JavaScript Intl Methods Intl.PluralRules() JavaScript Intl.PluralRules() Constructor Definition new Intl.PluralRules(locales, options) builds a helper that answers which plural category a number belongs to. Call select(n) to get a string such as "one" or "other".
Use cardinal rules for counts (1 item / 2 items) and type: "ordinal" for ranks (1st, 2nd, 3rd).
new Intl.PluralRules(locales, options)
rules.select(n)
cardinal → "one", "other", ...
type: "ordinal" → "one", "two", "few", "other", ... Syntax Create PluralRules, then call select with a number.
const rules = new Intl.PluralRules("en");
console.log(rules.select(1));
console.log(rules.select(2)); Call What it does new Intl.PluralRules("en")English cardinal categories. rules.select(1)Returns "one" in English. rules.select(2)Returns "other" in English. { type: "ordinal" }Categories for 1st, 2nd, 3rd-style ranks.
A standard JavaScript constructor on the Intl object: create one with new Intl.PluralRules(). No import required. Siblings: Intl.getCanonicalLocales() , Intl.supportedValuesOf() , Intl.Collator() , Intl.DateTimeFormat() , Intl.DisplayNames() , Intl.DurationFormat() , Intl.ListFormat() , Intl.Locale() , Intl.NumberFormat() , Intl.RelativeTimeFormat() , Intl.Segmenter() .
Library declarations // ECMAScript 2018 — Intl.PluralRules (widely available)
new Intl.PluralRules(locales, options)
rules.select(n)
// options.type : "cardinal" | "ordinal"
// select returns: "zero" | "one" | "two" | "few" | "many" | "other" Parameters Parameter Description locales Optional. Locale string or list, such as "en" or "fr". options Optional. Mainly type: cardinal (default) or ordinal. n For select: the number to classify.
Return Value Return Value Description PluralRules object From the constructor. string A plural category name from select.
JavaScript Examples 1. Cardinal 2. Ordinal 3. Locale difference Example 1 — English Cardinal Categories In English, 1 is one and most other counts are other.
const rules = new Intl.PluralRules("en");
console.log("1: " + rules.select(1));
console.log("2: " + rules.select(2)); How It Works select(1). English uses the one category for a single item.select(2). Two (and most other numbers) map to other.Message maps. Use the category to pick "item" vs "items".Example 2 — English Ordinal Categories Ordinal type helps with 1st, 2nd and 3rd endings.
const rules = new Intl.PluralRules("en", { type: "ordinal" });
console.log("1: " + rules.select(1));
console.log("2: " + rules.select(2));
console.log("3: " + rules.select(3)); How It Works type ordinal. Categories follow ranking patterns, not plain counts.one / two / few. English maps 1 → one, 2 → two, 3 → few for suffixes.Build labels. Map those names to st, nd and rd in your own strings.Example 3 — Zero Differs in French and English French treats 0 as one for cardinal plurals; English treats 0 as other.
const fr = new Intl.PluralRules("fr");
const en = new Intl.PluralRules("en");
console.log("fr 0: " + fr.select(0));
console.log("en 0: " + en.select(0)); How It Works Locale rules differ. Do not hard-code English assumptions for every language.French zero. 0 uses the one category in French cardinal rules.English zero. 0 uses other, like most non-1 numbers.Compatibility
Browser & Runtime Support Intl.PluralRules is part of the original ES2015 Intl API (or arrived soon after and is now everywhere). Every current browser and Node.js has it.
✓ ES2015 · Widely supported
Intl.PluralRules Supported in Chrome 24+, Edge 12+, Firefox 29+, Safari 10+, Opera 15+ and Node.js 0.12+. Internet Explorer had partial Intl support only.
Google Chrome 24+ · Desktop & Mobile
Full support
Microsoft Edge 12+ · Chromium based
Full support
Mozilla Firefox 29+ · Desktop & Mobile
Full support
Apple Safari 10+ · macOS & iOS
Full support
Opera 15+ · Chromium based
Full support
Samsung Internet Recent versions · Android
Supported
Android WebView 24+ · Chromium based
Supported
Node.js 0.12+ · Server runtime
Supported
Deno Supported · JavaScript runtime
Supported
Bun Supported · JavaScript runtime
Supported
Internet Explorer No native support
Not supported Intl.PluralRules Excellent
Bottom line: Safe to use in every current browser and in Node.js. No feature-detect needed for modern code.
Frequently Asked Questions What does Intl.PluralRules do? It tells you which plural category a number belongs to in a locale, such as one or other.
What is the difference between cardinal and ordinal? Cardinal is for counts (1 apple, 2 apples). Ordinal is for ranks (1st, 2nd, 3rd).
Does select return the word apple? No. It returns a category name. Your code chooses the message text for that category.
Why does French select(0) return one? French plural rules put 0 in the one category. English puts 0 in other.
Which categories exist? Possible values include zero, one, two, few, many and other. A locale uses only the ones it needs.
About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
12 people found this page helpful
Helpful Share Copy link Suggestion