Cldr.Number.PluralRule (Cldr v2.23.0) View Source
Defines the plural rule implementation modules. The functions in this module generate code to implement the plural rules of CLDR.
Link to this section Summary
Functions
Returns a list of the possible pluralization types
Returns the plural type for a given number.
Link to this section Types
Specs
operand() :: any()
Specs
plural_type() :: :zero | :one | :two | :few | :many | :other
Link to this section Functions
Specs
known_plural_types() :: [plural_type()]
Returns a list of the possible pluralization types
Returns the plural type for a given number.
Arguments
numberis an integer, float or Decimal numberbackendis any module that includesuse Cldrand therefore is aCldrbackend module. The default isCldr.default_backend!/0.optionsis a keyword list of options
Options
localeis any valid locale name returned byCldr.known_locale_names/1or aCldr.LanguageTagstruct returned byCldr.Locale.new!/2, The default isCldr.get_locale/0.backendis any module that includesuse Cldrand therefore is aCldrbackend module. The default isCldr.default_backend!/0. This option allows the backend to be specified as an argument or an option.typeis eitherCardinalorOrdinal. The default isCardinal.
Examples
iex> Cldr.Number.PluralRule.plural_type(123)
:other
iex> Cldr.Number.PluralRule.plural_type(123, type: Ordinal)
:few
iex> Cldr.Number.PluralRule.plural_type(123, type: Cardinal)
:other
iex> Cldr.Number.PluralRule.plural_type(2, locale: "de")
:other