Plug that persists the locale discovered by Localize.Plug.PutLocale into the session.
The session key is fixed to "localize_locale" so that downstream functions like LiveView on_mount callbacks can retrieve the locale without needing additional configuration.
Options
:asdetermines the format in which the locale is saved in the session. The valid settings are::stringin which the current locale is converted to a string before storing in the session. It will then be parsed back into a%Localize.LanguageTag{}upon reading it from the session. This option minimises space used in the session at the expense of CPU time to serialize and parse.:language_tagin which the current locale is stored in the session in its native%Localize.LanguageTag{}format. This minimizes CPU time at the expense of larger session storage.
The default is as: :string.
Examples
plug Localize.Plug.PutLocale,
apps: [:localize, :gettext],
from: [:path, :query],
gettext: MyApp.Gettext
plug Localize.Plug.PutSession, as: :string