<intl-plural>
<intl-plural> selects a plural category from locale rules and renders the matching category text.
Native reference: Intl.PluralRules
1<intl-plural one="item" other="items">2</intl-plural>Attributes and properties
| Attribute | JS property | Type | Description |
|---|---|---|---|
value | value | number/string | Number to classify. Child text is used when omitted. |
locale | locale | string | Overrides the runtime locale. |
type | type | cardinal | ordinal | Plural rules type. Defaults to cardinal. |
zero | zero | string | Text for the zero category. |
one | one | string | Text for the one category. |
two | two | string | Text for the two category. |
few | few | string | Text for the few category. |
many | many | string | Text for the many category. |
other | other | string | Text for the other category and fallback text when a category is missing. |
value
Use child text for static values.
1<intl-plural one="item" other="items">2</intl-plural>Use the property from JavaScript when the count is dynamic.
1<intl-plural id="cart-count" one="item" other="items">0</intl-plural>2 3<script>4 document.getElementById('cart-count').value = 35</script>locale
Use locale when a specific plural rule should be applied.
1<intl-plural locale="en" one="item" other="items">1</intl-plural>2<intl-plural locale="fr" one="article" other="articles">1</intl-plural>type
Use type="cardinal" for quantities. Use type="ordinal" for ranking suffixes.
1<intl-plural type="cardinal" one="message" other="messages">5</intl-plural>2 3<intl-plural4 type="ordinal"5 one="st"6 two="nd"7 few="rd"8 other="th"9>10 311</intl-plural>For type="ordinal", the formatter prepends the numeric value to the selected suffix.
zero
Use zero for locales or product copy where zero has a dedicated phrase.
1<intl-plural zero="no files" one="file" other="files">0</intl-plural>one
Use one for the singular category.
1<intl-plural one="message" other="messages">1</intl-plural>two
Some locales use a two category.
1<intl-plural locale="ar" one="one item" two="two items" other="items">2</intl-plural>few
Some locales use a few category.
1<intl-plural locale="ar" few="a few items" other="items">3</intl-plural>many
Some locales use a many category.
1<intl-plural locale="ar" many="many items" other="items">11</intl-plural>other
Always provide other. It is the standard fallback when the selected category is not provided.
1<intl-plural one="file" other="files">12</intl-plural>Locale-specific categories
Provide every category your supported locales need.
1<intl-plural2 locale="ar"3 zero="zero"4 one="one"5 two="two"6 few="few"7 many="many"8 other="other"9>10 311</intl-plural>