Money.Cldr.Number.Ordinal.pluralize
You're seeing just the function
pluralize
, go back to Money.Cldr.Number.Ordinal module for more information.
Specs
pluralize( Cldr.Math.number_or_decimal() | %Range{first: term(), last: term(), step: term()}, Cldr.LanguageTag.t() | Cldr.Locale.locale_name(), %{} ) :: any()
Pluralize a number using ordinal plural rules and a substition map.
Arguments
number
is an integer, float or Decimal or aRange.t{}
. When a range, The is that in any usage, the start value is strictly less than the end value, and that no values are negative. Results for any cases that do not meet these criteria are undefined.locale
is any locale returned byMoney.Cldr.Locale.new!/1
or anylocale_name
returned byMoney.Cldr.known_locale_names/0
substitutions
is a map that maps plural keys to a string. The valid substitution keys are:zero
,:one
,:two
,:few
,:many
and:other
.
See also Money.Cldr.Number.Ordinal.Ordinal.plural_rule/3
.
Examples
iex> Money.Cldr.Number.Ordinal.pluralize 1, "en", %{one: "one"}
"one"
iex> Money.Cldr.Number.Ordinal.pluralize 2, "en", %{one: "one"}
nil
iex> Money.Cldr.Number.Ordinal.pluralize 2, "en", %{one: "one", two: "two"}
"two"
iex> Money.Cldr.Number.Ordinal.pluralize 22, "en", %{one: "one", two: "two", other: "other"}
"two"
iex> Money.Cldr.Number.Ordinal.pluralize Decimal.new(1), "en", %{one: "one"}
"one"
iex> Money.Cldr.Number.Ordinal.pluralize Decimal.new(2), "en", %{one: "one"}
nil
iex> Money.Cldr.Number.Ordinal.pluralize Decimal.new(2), "en", %{one: "one", two: "two"}
"two"
iex> Money.Cldr.Number.Ordinal.pluralize 1..10, "ar", %{one: "one", few: "few", other: "other"}
"other"
iex> Money.Cldr.Number.Ordinal.pluralize 1..10, "en", %{one: "one", few: "few", other: "other"}
"other"