Cldr.Currency.pluralize
You're seeing just the function
pluralize
, go back to Cldr.Currency module for more information.
Specs
pluralize(pos_integer(), code(), Cldr.backend(), Keyword.t()) :: {:ok, String.t()} | {:error, {module(), String.t()}}
Returns the appropriate currency display name for the currency
, based
on the plural rules in effect for the locale
.
Arguments
number
is an integer, float orDecimal
currency
is any currency returned byCldr.Currency.known_currencies/0
locale
is any valid locale name returned byCldr.known_locale_names/1
or aCldr.LanguageTag
struct returned byCldr.Locale.new!/2
backend
is any module that includesuse Cldr
and therefore is aCldr
backend moduleoptions
is a keyword list of options
Options
:locale
is any locale returned byCldr.Locale.new!/2
. The default is<backend>.get_locale/1
Returns
{:ok, plural_string}
or{:error, {exception, message}}
Examples
iex> Cldr.Currency.pluralize 1, :USD, MyApp.Cldr
{:ok, "US dollar"}
iex> Cldr.Currency.pluralize 3, :USD, MyApp.Cldr
{:ok, "US dollars"}
iex> Cldr.Currency.pluralize 12, :USD, MyApp.Cldr, locale: "zh"
{:ok, "美元"}
iex> Cldr.Currency.pluralize 12, :USD, MyApp.Cldr, locale: "fr"
{:ok, "dollars des États-Unis"}
iex> Cldr.Currency.pluralize 1, :USD, MyApp.Cldr, locale: "fr"
{:ok, "dollar des États-Unis"}