MyApp.Cldr.Number.Cardinal.pluralize

You're seeing just the function pluralize, go back to MyApp.Cldr.Number.Cardinal module for more information.
Link to this function

pluralize(number, locale_name, substitutions)

View Source

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 Decimal

  • locale is any locale returned by MyApp.Cldr.Locale.new!/1 or any locale_name returned by MyApp.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.Cardinal.Cardinal.plural_rule/3.

Examples

iex> MyApp.Cldr.Number.Cardinal.pluralize 1, "en", %{one: "one"}
"one"

iex> MyApp.Cldr.Number.Cardinal.pluralize 2, "en", %{one: "one"}
nil

iex> MyApp.Cldr.Number.Cardinal.pluralize 2, "en", %{one: "one", two: "two", other: "other"}
"other"

iex> MyApp.Cldr.Number.Cardinal.pluralize 22, "en", %{one: "one", two: "two", other: "other"}
"other"

iex> MyApp.Cldr.Number.Cardinal.pluralize Decimal.new(1), "en", %{one: "one"}
"one"

iex> MyApp.Cldr.Number.Cardinal.pluralize Decimal.new(2), "en", %{one: "one"}
nil

iex> MyApp.Cldr.Number.Cardinal.pluralize Decimal.new(2), "en", %{one: "one", two: "two"}
nil

iex> MyApp.Cldr.Number.Cardinal.pluralize 1..10, "ar", %{one: "one", few: "few", other: "other"}
"few"

iex> MyApp.Cldr.Number.Cardinal.pluralize 1..10, "en", %{one: "one", few: "few", other: "other"}
"other"