Skip to content

tryParseLanguageTag

tryParseLanguageTag(text): LanguageTag | null

Defined in: packages/format-language-tag/src/parse-language-tag.ts:106

Parses a BCP 47 language tag, or answers null where the grammar is not met.

For callers that treat unparseable input as a normal outcome — validating a user-supplied locale, sniffing a filename — rather than as a fault.

string

LanguageTag | null