Parses a CLDR language tag (also referred to as locale string).
The applicable specification is from CLDR which is similar based upon RFC5646 with some variations.
This module performs grammar-level parsing only. It returns a bare
map with language, script, and territory as strings (no
atomization). Validity checking and atomization happen in
Localize.LanguageTag.parse/1, which gates atomization behind the
bounded validity sets so untrusted input cannot exhaust the atom
table.
Summary
Functions
Parse a locale identifier into a bare map of subtag fields.
Parse a locale identifier into a bare map, raising on error.
Functions
Parse a locale identifier into a bare map of subtag fields.
locale_idis a string representation of a language tag as defined by RFC5646.
Returns
{:ok, map}wheremapcarries the parsed subtags. The:language,:script, and:territoryvalues are normalised strings (not atoms); the caller is responsible for validating and atomising them.{:error, exception}if the grammar parse fails.
Parse a locale identifier into a bare map, raising on error.
See parse/1 for the return shape.