mirror of
https://github.com/teslamate-org/teslamate.git
synced 2026-01-24 21:06:08 +08:00
13 lines
327 B
Elixir
13 lines
327 B
Elixir
defmodule TeslaMateWeb.InitAssigns do
|
|
@moduledoc """
|
|
Ensures common `assigns` are applied to all LiveViews attaching this hook.
|
|
"""
|
|
|
|
import Phoenix.LiveView
|
|
|
|
def on_mount(:locale, _params, %{"gettext_locale" => locale}, socket) do
|
|
Gettext.put_locale(locale)
|
|
{:cont, assign(socket, :locale, locale)}
|
|
end
|
|
end
|