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.

zhCN
:
Intl.Locale.Locale

Simplified Chinese

zhTW
:
Intl.Locale.Locale

Traditional Chinese

Basic information
README
Browse source on Github
Elm version: 0.17.1 <= v < 0.18.0
Contains Native Module(s)
Modules
Intl.Collator Intl.Currency Intl.DateTimeFormat
Intl.Locale
Intl.NumberFormat Intl.TimeZone
Versions
1.0.0
Dependencies