Cldr.Unit.display_name
You're seeing just the function
display_name
, go back to Cldr.Unit module for more information.
Returns the localized display name for a unit.
The returned text is generally suitable for including in UI elements such as selection boxes.
Arguments
unit
is anyt:Cldr.Unit
or any unit name returned byCldr.Unit.known_units/0
.options
is a keyword list of options.
Options
:locale
is any valid locale name returned byCldr.known_locale_names/0
or aCldr.LanguageTag
struct. 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
.:style
is one of those returned byCldr.Unit.available_styles
. The current styles are:long
,:short
and:narrow
. The default isstyle: :long
.
Examples
iex> Cldr.Unit.display_name :liter
"liters"
iex> Cldr.Unit.display_name :liter, locale: "fr"
"litres"
iex> Cldr.Unit.display_name :liter, locale: "fr", style: :short
"l"