# `Localize.Plug.AcceptLanguage`
[🔗](https://github.com/kipcole9/localize_web/blob/main/lib/localize/plug/accept_language.ex#L1)

Standalone plug that parses the `Accept-Language` header and sets `conn.private[:localize_locale]` to the
best matching locale.

The locale can be later retrieved by `Localize.Plug.AcceptLanguage.get_locale/1`. This plug is useful
when you only need accept-language parsing without the full locale discovery pipeline of `Localize.Plug.PutLocale`.

### Options

* `:no_match_log_level` determines the logging level for the case when no matching locale is configured to meet the user's
  request. The default is `:warning`. If set to `nil` then no logging is performed.

### Examples

    plug Localize.Plug.AcceptLanguage

# `best_match`

Returns the best matching locale for the provided accept-language header value.

### Arguments

* `accept_language` is an accept-language header string or `nil`.

* `options` is the plug options map containing `:log_level`.

### Returns

* A `t:Localize.LanguageTag.t/0` or `nil`.

# `get_locale`

Returns the locale set by `Localize.Plug.AcceptLanguage`.

### Arguments

* `conn` is a `t:Plug.Conn.t/0`.

### Returns

* A `t:Localize.LanguageTag.t/0` or `nil`.

---

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