Cldr.Currency.display_name
You're seeing just the function
display_name
, go back to Cldr.Currency module for more information.
Specs
Return the display name for a currency.
The display name is useful for UI
uses, for example in menus. The display name
is typically capitalized for stand-alone use
where as the display name returned by
Cldr.Currency.pluralize/4
is typically
lower-cased for use within sentences.
Arguments
currency
is any currency code returned byCldr.Currency.known_currencies/0
or at:Cldr.Currency
struct returned byCldr.Currency.currency_for_code/3
Options
:locale
is any locale returned byCldr.Locale.new!/2
. The default isCldr.get_locale/0
:backend
is any module that includesuse Cldr
and therefore is aCldr
backend module. The default isCldr.default_backend!/0
Returns
{:ok, display_name}
or
{:error, {exception, reason}}
Examples
iex> Cldr.Currency.display_name :AUD, backend: MyApp.Cldr
{:ok, "Australian Dollar"}
iex> Cldr.Currency.display_name "AUD", backend: MyApp.Cldr, locale: "fr"
{:ok, "dollar australien"}
iex> Cldr.Currency.display_name "EUR", backend: MyApp.Cldr, locale: "de"
{:ok, "Euro"}
iex> Cldr.Currency.display_name "ZZZ", backend: MyApp.Cldr
{:error, {Cldr.UnknownCurrencyError, "The currency \"ZZZ\" is invalid"}}