MyApp.Cldr.Territory.from_language_tag
You're seeing just the function
from_language_tag
, go back to MyApp.Cldr.Territory module for more information.
Specs
from_language_tag(Cldr.Territory.tag(), Cldr.Territory.options()) :: {:ok, binary()} | {:error, Cldr.Territory.error()}
Localized string for the given LanguageTag.t
.
Returns {:ok, String.t}
if successful, otherwise {:error, reason}
.
options
are:style
is one of those returned byMyApp.Cldr.Territory.available_styles/0
. The current styles are:short
,:standard
and:variant
. The default is:standard
Example
iex> MyApp.Cldr.Territory.from_language_tag(Cldr.get_locale())
{:ok, "world"}
iex> MyApp.Cldr.Territory.from_language_tag(Cldr.get_locale(), [style: :short])
{:error, {Cldr.UnknownStyleError, "The style :short is unknown"}}
iex> MyApp.Cldr.Territory.from_language_tag(Cldr.get_locale(), [style: :ZZZ])
{:error, {Cldr.UnknownStyleError, "The style :ZZZ is unknown"}}
iex> MyApp.Cldr.Territory.from_language_tag(Cldr.get_locale(), [style: "ZZZ"])
{:error, {Cldr.UnknownStyleError, "The style \"ZZZ\" is unknown"}}