Skip to content

Latest commit

 

History

History
26 lines (23 loc) · 878 Bytes

README.md

File metadata and controls

26 lines (23 loc) · 878 Bytes

BCP 47 Build Status

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.