Money.Cldr.Number.Ordinal.pluralize

You're seeing just the function pluralize, go back to Money.Cldr.Number.Ordinal 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(), 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 a Range.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 by Money.Cldr.Locale.new!/1 or any locale_name returned by Money.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"