parseLanguageTag
parseLanguageTag(
text):LanguageTag
Defined in: packages/format-language-tag/src/parse-language-tag.ts:83
Parses a BCP 47 language tag.
Recognises the whole Language-Tag production: langtag, a private-use-only
tag, and the seventeen irregular grandfathered tags. The regular
grandfathered tags parse as ordinary langtags, which is what they are.
Only well-formedness is checked. A tag whose subtags are absent from the IANA
registry — qq-Zxxx-QQ — is well-formed and parses without complaint.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Throws
Section titled “Throws”When text does not match the grammar.