views:

157

answers:

1

hello,

I am changing the locale in the app controller

before_filter :set_locale
def set_locale 
  I18n.locale = params[:hl] || I18n.default_locale 
end

for a Page that contains rendered partials and has a layout which yields the menu items.

The static text from the Page is translated to the new locale, however the static text from the layout isn't, including the yielded menu items.

It looks like a threading issue.

Has someone encountered this behavior for I18n?

A: 

I found a workaround in setting the default_locale to the new locale in before_filter and in after_filter setting the default_locale back to its initial value.

But if someone accesses an instance of the site while for some other instance, ran by the user changing his locale, the after_filter hasn't been called yet it will display the wrong language (the new locale set)?

gabi