Language.get normalizes case and enforces syntactic validity whereas Language.make doesn’t. This causes some discrepancies. I presume that a user is not supposed to have to worry about case or syntactic validity once they have a valid (in the sense of is_valid) Language object.
If Language is valid, its tag should presumably be valid. This is not always true.
>>> lang = Language.make(language='Latn')
>>> lang.is_valid()
True
>>> tag_is_valid(lang.to_tag())
False
>>>
>>> lang = Language.make(script='Qaaa..Qabx')
>>> lang.is_valid()
True
>>> tag_is_valid(lang.to_tag())
False
>>>
>>> lang = Language.make(extensions='t-fr')
>>> lang.is_valid()
True
>>> tag_is_valid(lang.to_tag())
False
>>>
>>> lang = Language.make(extensions=['a'])
>>> lang.is_valid()
True
>>> tag_is_valid(lang.to_tag())
False
>>>
>>> lang = Language.make(language='x-')
>>> lang.is_valid()
True
>>> tag_is_valid(lang.to_tag())
False
Round-tripping a valid Language through its tag should presumably return an equivalent Language. This is not always true.
>>> lang = Language.make(language='FR')
>>> lang.is_valid()
True
>>> lang == Language.get(lang.to_tag(), normalize=False)
False
Alternatively, maybe it is the user’s responsibility to normalize case and check for syntactic validity before calling Language.make. I don’t think the documentation actually says that though.
Language.getnormalizes case and enforces syntactic validity whereasLanguage.makedoesn’t. This causes some discrepancies. I presume that a user is not supposed to have to worry about case or syntactic validity once they have a valid (in the sense ofis_valid)Languageobject.If
Languageis valid, its tag should presumably be valid. This is not always true.Round-tripping a valid
Languagethrough its tag should presumably return an equivalentLanguage. This is not always true.Alternatively, maybe it is the user’s responsibility to normalize case and check for syntactic validity before calling
Language.make. I don’t think the documentation actually says that though.