Cldr.Locale.normalize_locale_name
You're seeing just the function
normalize_locale_name
, go back to Cldr.Locale module for more information.
Specs
normalize_locale_name(locale_name()) :: locale_name()
Normalize the casing of a locale name.
Options
locale_name
is any valid locale name returned byCldr.known_locale_names/1
or aCldr.LanguageTag
struct
Returns
- The normalized locale name as a
String.t
Method
Locale names are case insensitive but certain common casing is followed in practise:
- lower case for a language
- capital case for a script
- upper case for a region/territory
Note this function is intended to support only the CLDR locale names which have a format that is a subset of the full language tag specification.
For proper parsing of local names and language tags, see
Cldr.Locale.canonical_language_tag/2
Examples
iex> Cldr.Locale.normalize_locale_name "zh_hant"
"zh-Hant"
iex> Cldr.Locale.normalize_locale_name "en_us"
"en-US"
iex> Cldr.Locale.normalize_locale_name "EN"
"en"
iex> Cldr.Locale.normalize_locale_name "ca_es_valencia"
"ca-ES-VALENCIA"