Cldr v2.20.0-rc.0 MyApp.Cldr.Locale View Source
Backend module that provides functions to define new locales.
Link to this section Summary
Functions
Returns the territory from a language tag or locale name.
Returns the time zone from a language tag or locale name.
Link to this section Functions
Specs
territory_from_locale(Cldr.LanguageTag.t() | Cldr.Locale.locale_name()) :: Cldr.territory()
Returns the territory from a language tag or locale name.
Arguments
locale
is any language tag returned beCldr.Locale.new/2
or a locale name in the list returned byCldr.known_locale_names/1
Returns
- A territory code as an atom
Examples
iex> MyApp.Cldr.Locale.territory_from_locale "en-US"
:US
iex> MyApp.Cldr.Locale.territory_from_locale "en-US-u-rg-GBzzzz"
:GB
Specs
timezone_from_locale(Cldr.LanguageTag.t() | Cldr.Locale.locale_name()) :: String.t() | {:error, {module(), String.t()}}
Returns the time zone from a language tag or locale name.
Arguments
locale
is any language tag returned beCldr.Locale.new/2
or a locale name in the list returned byCldr.known_locale_names/1
Returns
A time zone ID as a string or
:error
if no time zone can be determined
Examples
iex> MyApp.Cldr.Locale.timezone_from_locale "en-US-u-tz-ausyd"
"Australia/Sydney"