Answer the question
In order to leave comments, you need to log in
In production, not all strings are updated when localization changes dynamically in a Rails application. Why?
In production, I use the NGINX + PASSENGER bundle.
I change the locales in the ApplicationController like this: I18n.locale = current_user.locale rescue :en
However, not all phrases are translated into the newly installed locale until, for example, touch tmp/restart.txt is done. If you wait a while, refresh the page, then everything is seized. The problem does not always recur. What could it be? Is nginx caching? Rail buggy?
Answer the question
In order to leave comments, you need to log in
As far as I can judge, your method insures you against an exception, but not from the "error-free" return of some crooked value from current_user.locale
I would write something like this
I18n.locale = ([current_user.try(:locale)] & [:en, :ru, :etc]).first || :en
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question