MyApp.Cldr.Number.Ordinal.pluralize
You're seeing just the function
pluralize
, go back to MyApp.Cldr.Number.Ordinal module for more information.
Specs
pluralize( Cldr.Math.number_or_decimal() | %Range{first: term(), last: 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 byMyApp.Cldr.Locale.new!/1
or anylocale_name
returned byMyApp.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 MyApp.Cldr.Number.Ordinal.Ordinal.plural_rule/3
.
Examples
iex> MyApp.Cldr.Number.Ordinal.pluralize 1, "en", %{one: "one"}
"one"
iex> MyApp.Cldr.Number.Ordinal.pluralize 2, "en", %{one: "one"}
nil
iex> MyApp.Cldr.Number.Ordinal.pluralize 2, "en", %{one: "one", two: "two"}
"two"
iex> MyApp.Cldr.Number.Ordinal.pluralize 22, "en", %{one: "one", two: "two", other: "other"}
"two"
iex> MyApp.Cldr.Number.Ordinal.pluralize Decimal.new(1), "en", %{one: "one"}
"one"
iex> MyApp.Cldr.Number.Ordinal.pluralize Decimal.new(2), "en", %{one: "one"}
nil
iex> MyApp.Cldr.Number.Ordinal.pluralize Decimal.new(2), "en", %{one: "one", two: "two"}
"two"
iex> MyApp.Cldr.Number.Ordinal.pluralize 1..10, "ar", %{one: "one", few: "few", other: "other"}
"other"
iex> MyApp.Cldr.Number.Ordinal.pluralize 1..10, "en", %{one: "one", few: "few", other: "other"}
"other"