SoftBank.Cldr.Number.Cardinal.pluralize
You're seeing just the function
pluralize
, go back to SoftBank.Cldr.Number.Cardinal 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 cardinal plural rules and a substition map.
Arguments
number
is an integer, float or Decimallocale
is any locale returned bySoftBank.Cldr.Locale.new!/1
or anylocale_name
returned bySoftBank.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 SoftBank.Cldr.Number.Cardinal.Cardinal.plural_rule/3
.
Examples
iex> SoftBank.Cldr.Number.Cardinal.pluralize 1, "en", %{one: "one"}
"one"
iex> SoftBank.Cldr.Number.Cardinal.pluralize 2, "en", %{one: "one"}
nil
iex> SoftBank.Cldr.Number.Cardinal.pluralize 2, "en", %{one: "one", two: "two", other: "other"}
"other"
iex> SoftBank.Cldr.Number.Cardinal.pluralize 22, "en", %{one: "one", two: "two", other: "other"}
"other"
iex> SoftBank.Cldr.Number.Cardinal.pluralize Decimal.new(1), "en", %{one: "one"}
"one"
iex> SoftBank.Cldr.Number.Cardinal.pluralize Decimal.new(2), "en", %{one: "one"}
nil
iex> SoftBank.Cldr.Number.Cardinal.pluralize Decimal.new(2), "en", %{one: "one", two: "two"}
nil
iex> SoftBank.Cldr.Number.Cardinal.pluralize 1..10, "ar", %{one: "one", few: "few", other: "other"}
"few"
iex> SoftBank.Cldr.Number.Cardinal.pluralize 1..10, "en", %{one: "one", few: "few", other: "other"}
"other"