Intl.Locale
A Locale represents a BCP 47 language tag including optional script, region, variant, and extensions.
type Locale
The Locale type holds a valid BCP 47 language tag.
fromLanguageTag
:
String -> Maybe.Maybe Intl.Locale.Locale
Checks the string as a valid language tag, and returns a locale if it is.
Unicode extensions can be added to the language tag that customize the behavior.
Although any explicit options used in fromOptions will take precendence over
the locale extensions.
-- German Phone Book sorting
fromLanguageTag "de-u-co-phonebk"
If a string is passed that is not a valid BCP 47 language tag, Nothing will be
returned.
toLanguageTag
:
Intl.Locale.Locale -> String
Gets the string language tag from a Locale
toLanguageTag Locale.zhCN == "zh-CN"
Predefined Locales
A few locales have been pre-defined for convenience.
en
:
Intl.Locale.Locale
English
zhCN
:
Intl.Locale.Locale
Simplified Chinese
zhTW
:
Intl.Locale.Locale
Traditional Chinese
fr
:
Intl.Locale.Locale
French
de
:
Intl.Locale.Locale
German
it
:
Intl.Locale.Locale
Italian
ja
:
Intl.Locale.Locale
Japanese
ko
:
Intl.Locale.Locale
Korean