dillonkearns / elm-bcp47-language-tag / LanguageTag.PrivateUse

Private use tags. They begin with an x-, can be 1 to 8 character long, and can be freely defined and used without any registration.


type alias PrivateUse =
LanguageTag.Internal.PrivateUse

toCodeString : PrivateUse -> String

Convert the tag to its String representation.

fromStrings : List String -> Maybe PrivateUse

Create a PrivateUse from its components.

Fails if the list is empty or any of the components are outside the expected size (1 to 8 characters).

The x- is added automatically by toCodeString.

fromStrings [ "whatever" ] |> Maybe.map toCodeString
--> Just "x-whatever"

fromStrings [ "x", "whatever" ] |> Maybe.map toCodeString
--> Just "x-x-whatever"

fromStrings []
--> Nothing

fromStrings [ "thisistoolong" ]
--> Nothing