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_leveldetermines the logging level for the case when no matching locale is configured to meet the user's request. The default is:warning. If set tonilthen no logging is performed.
Examples
plug Localize.Plug.AcceptLanguage
Summary
Functions
Returns the best matching locale for the provided accept-language header value.
Returns the locale set by Localize.Plug.AcceptLanguage.
Functions
Returns the best matching locale for the provided accept-language header value.
Arguments
accept_languageis an accept-language header string ornil.optionsis the plug options map containing:log_level.
Returns
- A
Localize.LanguageTag.t/0ornil.
Returns the locale set by Localize.Plug.AcceptLanguage.
Arguments
connis aPlug.Conn.t/0.
Returns
- A
Localize.LanguageTag.t/0ornil.