View Source I18nHelpers.Plugs.PutLocaleFromDomain (I18n Helpers v0.14.0)
Plug to fetch the locale from the URL's subdomain; assigns the locale to the Connection and sets the Gettext locale.
This plug is useful if you have URLs similar to:
https://mon-super-site.example/bonjour
https://mijn-geweldige-website.example/hallo
https://mi-gran-sitio.example/hola
https://my-awesome-website.example/helloOptions
:domains_locales_map- map where each key represents a domain and each value contains the locale to be used for that domain:default_locale- locale to be used if no locale was found in the URL:allowed_locales- a list of allowed locales. If no locale was found, use the:default localeif specified, otherwise raise an error.
:domains_locales_map is a mandatory option. Below is an example of a map
it can hold:
%{
"mon-super-site.example" => "fr",
"mijn-geweldige-website.example" => "nl",
"mi-gran-sitio.example" => "es",
"my-awesome-website.example" => "en"
}
Summary
Functions
@spec call( Plug.Conn.t(), keyword() ) :: Plug.Conn.t()