I am trying to use i18n in rails. I want the language to be set first
from params[:locale] (probably already in the url) then from the browser
http header and lastly from the default_locale. Everything is fine. Now
the problem starts, when I want to add a dropdown list to allow the user
to change the locale. How do I force the page to reload with the new
Locale? FYI, I tried using .js and forcing a page.reload. The result was
that the it kept the same locale in the url after the reload. Any ideas?
Why don't you just do a simple form that does a GET to the same page
with the locale as a parameter?
You say it's first set from params[:locale]
So all you need to do is open page with ?locale=xx
Here are some some commits with example code for what you are after written by my coworker Kieran for the open source Kete app:
Note that available locales are pulled from a config/locales.yml file.
Hope this helps,