1 changed files with 2 additions and 1 deletions
|
|
@ -37,7 +37,8 @@ defmodule MvWeb.LiveUserAuth do
|
|||
end
|
||||
|
||||
def on_mount(:live_no_user, _params, session, socket) do
|
||||
# Set the locale for not logged in user to set the language
|
||||
# Set the locale for not logged in user to set the language in the Log-In Screen
|
||||
|
rafael marked this conversation as resolved
Outdated
|
||||
# otherwise the locale is not taken for the Log-In Screen
|
||||
locale = session["locale"] || "en"
|
||||
|
rafael marked this conversation as resolved
Outdated
rafael
commented
Do we also need to set the locale here when the router already does it? Do we also need to set the locale here when the router already does it?
carla
commented
Yes, otherwise the login scren is not translated. At least I found no other way. Yes, otherwise the login scren is not translated. At least I found no other way.
rafael
commented
Okay, could you add a comment saying that this is the reason? This will make it easier to understand if somebody stumbles upon this in the future :) Okay, could you add a comment saying that this is the reason? This will make it easier to understand if somebody stumbles upon this in the future :)
|
||||
Gettext.put_locale(MvWeb.Gettext, locale)
|
||||
{:cont, assign(socket, :locale, locale)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue
Is there a way to detect the language of the user automatically? Maybe phoenix has a feature for that. This would make sure that folks who don't speak german will get the english login page. I think it makes sense to display the login page in german as a fallback, if the browser doesn't send a preferred language. Maybe we can open an issue for that? :)
I think adding a language switch to the login screen needs more customization than the overrides AshAuthentication provides. As I think it's not that high priority right now I added another issue, but to not spend time on it right now. Is that fine?
Yes, totally fine!