# `Localize.LanguageTag.Parser`
[🔗](https://github.com/elixir-localize/localize/blob/v0.39.0/lib/localize/language_tag/parser.ex#L1)

Parses a CLDR language tag (also referred to as locale string).

The applicable specification is from [CLDR](http://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers)
which is similar based upon [RFC5646](https://tools.ietf.org/html/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.

# `normalize_field`

# `parse`

Parse a locale identifier into a bare map of subtag fields.

* `locale_id` is a string representation of a language tag
  as defined by [RFC5646](https://tools.ietf.org/html/rfc5646).

Returns

* `{:ok, map}` where `map` carries the parsed subtags. The
  `:language`, `:script`, and `:territory` values are
  normalised strings (not atoms); the caller is responsible for
  validating and atomising them.

* `{:error, exception}` if the grammar parse fails.

# `parse!`

Parse a locale identifier into a bare map, raising on error.

See `parse/1` for the return shape.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
