Cldr.Number.PluralRule (Cldr v2.43.1)
View SourceDefines the plural rule implementation modules. The functions in this module generate code to implement the plural rules of CLDR.
Summary
Types
Defines the structure of a plural rule before compilation.
Defines the plural types into which a number can be categorised.
Functions
Returns a list of the possible pluralization types
Returns the plural type for a given number.
Types
Functions
@spec 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 number.
- backendis any module that includes- use Cldrand therefore is a- Cldrbackend module. The default is- Cldr.default_backend!/0.
- optionsis a keyword list of options.
Options
- localeis any valid locale name returned by- Cldr.known_locale_names/1or a- Cldr.LanguageTagstruct returned by- Cldr.Locale.new!/2, The default is- Cldr.get_locale/0.
- backendis any module that includes- use Cldrand therefore is a- Cldrbackend module. The default is- Cldr.default_backend!/0. This option allows the backend to be specified as an argument or an option.
- typeis either- Cardinalor- Ordinal. The default is- Cardinal.
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