MyApp.Cldr.Territory.from_territory_code

You're seeing just the function from_territory_code, go back to MyApp.Cldr.Territory module for more information.
Link to this function

from_territory_code(territory_code, options \\ [locale: MyApp.Cldr.get_locale(), style: :standard])

View Source

Specs

from_territory_code(Cldr.Territory.atom_binary_tag(), Cldr.Territory.options()) ::
  {:ok, binary()} | {:error, Cldr.Territory.error()}

Localized string for the given territory code. Returns {:ok, String.t} if successful, otherwise {:error, reason}.

Example

iex> MyApp.Cldr.Territory.from_territory_code(:GB)
{:ok, "United Kingdom"}

iex> MyApp.Cldr.Territory.from_territory_code(:GB, [style: :short])
{:ok, "UK"}

iex> MyApp.Cldr.Territory.from_territory_code(:GB, [style: :ZZZ])
{:error, {Cldr.UnknownStyleError, "The style :ZZZ is unknown"}}

iex> MyApp.Cldr.Territory.from_territory_code(:GB, [style: "ZZZ"])
{:error, {Cldr.UnknownStyleError, "The style \"ZZZ\" is unknown"}}

iex> MyApp.Cldr.Territory.from_territory_code(:GB, [locale: "pt"])
{:ok, "Reino Unido"}

iex> MyApp.Cldr.Territory.from_territory_code(:GB, [locale: :zzz])
{:error, {Cldr.UnknownLocaleError, "The locale :zzz is not known."}}

iex> MyApp.Cldr.Territory.from_territory_code(:GB, [locale: "zzz"])
{:error, {Cldr.UnknownLocaleError, "The locale \"zzz\" is not known."}}