So i have different pages for different urls(locales). My problem is when i navigate from one page to the next, the default url comes up and you see the default site not the one specific for the initial url request.
So basically i initially access
htttp://localhost:3000/?locale=ru
for the first page in my application the russian site comes up. When i navigate to the next page it goes back to
htttp://localhost:3000
and loads this page. I have no idea why. Would anyone know?
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
I have done this.
thanks.
You need to persist the locale in your session; otherwise the information will be lost between requests, just as you’ve experienced. Do something like this:
That will set
@localeto whatever’s in the params, or whatever’s in the session, or what the default_locale is, and then set both the session and the I18n locale based on that.