Plural-sensitive number categorization, modelled on
Intl.PluralRules.
Returns the CLDR plural category (:zero, :one, :two, :few,
:many, or :other) for a given number and locale.
Delegates to Localize.Number.PluralRule for the underlying
plural rule evaluation.
Summary
Functions
Returns the plural category for a given number.
Returns the plural category, raising on error.
Functions
Returns the plural category for a given number.
Arguments
numberis an integer, float, orDecimal.optionsis a keyword list of options.
Options
:localeis a locale identifier string or atom. The default is the current process locale.:typeis:cardinalor:ordinal. The default is:cardinal.
Returns
{:ok, category}wherecategoryis one of:zero,:one,:two,:few,:many, or:other.{:error, reason}if the locale or number is invalid.
Examples
iex> Intl.PluralRules.select(1, locale: "en")
{:ok, :one}
iex> Intl.PluralRules.select(2, locale: "en")
{:ok, :other}
iex> Intl.PluralRules.select(2, locale: "en", type: :ordinal)
{:ok, :two}
Returns the plural category, raising on error.
Same as select/2 but returns the category atom directly
or raises.
Arguments
numberis an integer, float, orDecimal.optionsis a keyword list of options.
Returns
- A plural category atom.
Examples
iex> Intl.PluralRules.select!(1, locale: "en")
:one