-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] How to set the Devise locale for current request (in a thread safe manner)? #282
Comments
It seems that some flash messages from devise are translated and others are not. It may be related to this: In order to reproduce the issue:
If you log in successfully, instead, the flash message is in the correct language. |
I doubt the issue is in this project. Can you take a look at heartcombo/devise#4823 to see if anything helps in there? |
I did some testing...
Presumably in the |
I got looking into this today. Setting From this thread where they discussed changing it in the Rails guide. The change was not made for thread safety as Xavier points out. That's lead to some confusion, but it's safe to use a |
I've updated the readme to warn against using |
This appears to be fixed in heartcombo/devise#5567 |
Currently I use this code as suggested by the Rails guide:
This is thread safe and works perfectly for the application... but not for Devise! Devise keeps using the default language (even if the translated YML files are present).
What should I do in order to tell Devise the language for the current user?
I know that there is I18n.locale but it is not thread safe...
The text was updated successfully, but these errors were encountered: