You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@andyduong1920 do you have more information about this case? What was the problem? In which situation was the local not assigned properly? (maybe in an Engine controller that did not inherit from the main ::ApplicationController? 🤔 )
My case is that around_action is resetting the locale to the default value after the action, and this is bad with Devise flash messages when login fails: because devise redirects to the login page, and sets the flash message after the action is completed, so the locale value used will be the default one, not the current one =/
Why
To set the locale in
before_action
, there will is a case that the I18n can't get the default locale for some request, I faced that in a project.For more details:
Solution
I think we should go with the Rails way, using
around_action
instead - https://guides.rubyonrails.org/i18n.html#managing-the-locale-across-requestsThe text was updated successfully, but these errors were encountered: