I18nHelpers.Plugs.PutLocaleFromPath (I18n Helpers v0.13.0) View Source

Plug to fetch the locale from the first segment of the URL's request path; assigns the locale to the Connection and sets the Gettext locale.

This plug is useful if you have URLs similar to:

https://example.com/fr/bonjour
https://example.com/nl/hallo
https://example.com/es/hola
https://example.com/hello (default locale "en")

Options

  • :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 locale if specified, otherwise raise an error.

Link to this section Summary

Link to this section Functions

Specs

call(Plug.Conn.t(), keyword()) :: Plug.Conn.t()

Specs

init(keyword()) :: keyword()