Hey @mindok
Thanks for the quick response. Seems like if you were linking to the issue but it was pruned.
In any case I was just wondering if there was something else in the works.
From the docs I already managed to get everything working (including LiveView) by doing this:
- Copying the gettext files to my priv dir
- Configuring gettext
config :sic, SicWeb.Gettext,
gettext: %{
domains: [
{“auth”, “priv/gettext/auth.pot”},
{“app”, “priv/gettext/default.pot”},
{“errors”, “priv/gettext/errors.pot”},
{“emails”, “priv/gettext/email.pot”}
]
},
locales: [“en”, “es”, “ca”, “fr”, “de”, “el”],
default_locale: “en”
- Hooking in a plug to set the locale in regular routes:
pipeline :browser do
plug :accepts, [“html”]
plug :fetch_session
plug SicWeb.Plugs.SetLocale
plug :fetch_live_flash
plug :put_root_layout, html: {SicWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :load_from_session
end
- And in the ash authentication routes:
sign_in_route register_path: "/register",
reset_path: "/reset",
auth_routes_prefix: "/auth",
on_mount: [
{SicWeb.LiveUserAuth, :live_no_user},
{SicWeb.LiveHelpers, :set_locale} #<==========
],
overrides: [SicWeb.AuthOverrides, AshAuthentication.Phoenix.Overrides.DaisyUI],
gettext_backend: {SicWeb.Gettext, "auth"} #<==========
The plug just extracts the locale from the Accept-Language header.
Hope this helps someone else