MyApp.Cldr.Number.Cardinal.plural_rule
You're seeing just the function
plural_rule
, go back to MyApp.Cldr.Number.Cardinal module for more information.
Specs
plural_rule( Cldr.Math.number_or_decimal(), Cldr.Locale.locale_name() | Cldr.LanguageTag.t(), atom() | pos_integer() ) :: Cldr.Number.PluralRule.plural_type()
Return the plural key for a given number in a given locale
Returns which plural key (:zero
, :one
, :two
, :few
,
:many
or :other
) a given number fits into within the
context of a given locale.
Note that these key names should not be interpreted
literally. For example, the key returned from
Cldr.Number.Ordinal.plural_rule(0, "en")
is actually
:other
, not :zero
.
This key can then be used to format a number, date, time, unit, list or other content in a plural-sensitive way.
Arguments
number
is anyinteger
,float
orDecimal
locale
is any locale returned byCldr.Locale.new!/2
or anylocale_name
returned byMyApp.Cldr.known_locale_names/0
rounding
is one of[:down, :up, :ceiling, :floor, :half_even, :half_up, :half_down]
. The default is:half_even
.
Examples
iex> MyApp.Cldr.Number.Cardinal.plural_rule 0, "fr"
:one
iex> MyApp.Cldr.Number.Cardinal.plural_rule 0, "en"
:other