Cldr.Plug.SetSession (Cldr v2.21.0) View Source
Sets a session key for the CLDR locale.
The session
key is fixed to be cldr_locale
in order that downstream
functions like those in liveview
don't have to
be passed options.
Examples
# Define a router module that
# sets the locale for the current process
# and then also sets it in the session
defmodule MyAppWeb.Router do
use MyAppWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug Cldr.Plug.SetLocale,
apps: [:cldr, :gettext],
from: [:path, :query],
gettext: MyApp.Gettext,
cldr: MyApp.Cldr
plug :Cldr.Plug.SetSession
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
end