Intl.PluralRules
Intl.PluralRules determines which plural category a number belongs to in a given locale. It is useful when UI copy changes based on singular, plural, or other locale-specific forms.
Overview
Intl.PluralRules determines which plural category a number belongs to in a given locale. It is useful when UI copy changes based on singular, plural, or other locale-specific forms.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 63 | 18 | 58 | 13 | 63 | 13 | |
| Built-in object | ||||||
| The Intl.PluralRules() constructor creates Intl.PluralRules objects. | 63 | 18 | 58 | 13 | 63 | 13 |
Intl.PluralRules.PluralRules.options parameter `options` parameter | 106 | 106 | 116 | 15.4 | 106 | 15.4 |
Intl.PluralRules.PluralRules.options parameter.options roundingIncrement parameter `options.roundingIncrement` parameter | | | 116 | 17.2 | | 17.2 |
Intl.PluralRules.PluralRules.options parameter.options roundingMode parameter `options.roundingMode` parameter | 117 | 117 | 116 | 17.2 | 117 | 17.2 |
Intl.PluralRules.PluralRules.options parameter.options roundingPriority parameter `options.roundingPriority` parameter | 106 | 106 | 116 | 15.4 | 106 | 15.4 |
Intl.PluralRules.PluralRules.options parameter.options trailingZeroDisplay parameter Experimental `options.trailingZeroDisplay` parameter | | | 116 | | | |
| The resolvedOptions() method of Intl.PluralRules instances returns a new object with properties reflecting the options computed during initialization of this PluralRules object. | 63 | 18 | 58 | 13 | 63 | 13 |
| The select() method of Intl.PluralRules instances returns a string indicating which plural rule to use for locale-aware formatting of a number. | 63 | 18 | 58 | 13 | 63 | 13 |
| The selectRange() method of Intl.PluralRules instances receives two values and returns a string indicating which plural rule to use for locale-aware formatting of the indicated range. | 106 | 106 | 116 | 15.4 | 106 | 15.4 |
| The Intl.PluralRules.supportedLocalesOf() static method returns an array containing those of the provided locales that are supported in plural rules without having to fall back to the runtime's default locale. | 63 | 18 | 58 | 13 | 63 | 13 |
Syntax
const pr = new Intl.PluralRules('ja');
pr.select(1); // 'other' (Japanese has no plural form)
const en = new Intl.PluralRules('en');
en.select(1); // 'one'
en.select(2); // 'other' Live demo
Intl.PluralRules
Number. Multipleshapel-l read.word language per and. complex multipleshape to support.
word language per and. kacategory
word language to multipleshape. kacategorynumber that different.
Use cases
Count-aware labels
Choose the right wording for messages such as item counts, notifications, or validation summaries.
Locale-specific grammar
Support languages with more plural forms than simple singular/plural English logic.
Cautions
- Plural categories do not generate the final sentence for you, so you still need localized message templates.
- Do not assume every language maps neatly to one and other; some locales use multiple categories.
Accessibility
- Correct plural wording improves comprehension in status and summary messages, especially for screen reader users.
Related links
Powered by web-features