This library lets you parse language tags according to the specifications in
BCP 47: strings like "zh-cmn-Hans-CN"
,
"en-US"
, "ja-JP-u-ca-japanese"
, "x-whatever"
, ... . The first one, for example, would be turned into
languageTag =
LanguageTag
{ language =
{ shortestIso639Code = "zh"
, extension =
Just
{ selectedIso639Code = "cmn"
, reserved = []
}
}
, script = Just "Hans"
, region = Just (ISO3166_1 "CN")
, variants = []
, extensions = []
, privateUse = []
}
You can also turn these data back into canonicalized strings.