Skip to content

cozy-elixir/plug_locale

Repository files navigation

PlugLocale

CI Hex.pm built with Nix

Plugs for putting locale into assigns storage.

Installation

Add :plug_locale to the list of dependencies in mix.exs:

def deps do
  [
    {:plug_locale, <requirement>}
  ]
end

Usage

Different from set_locale, ex_cldr_plugs, etc, plug_locale:

  • only does one simple thing - setting a locale-related assign (by default, it is conn.assigns.locale).
  • does not make any assumptions about the localization strategy, so it is not tightly bound to packages like gettext or ex_cldr.

Check out PlugLocale.Browser, PlugLocale.Header in documentation for more details.

Thanks

This library is built on the wisdom in following code:

License

Apache License 2.0