On 17 Oct 2012, at 10:25, Soichi Ishida wrote:
> Rails 3.1.3
>
> Hi. My application's i18n seems to work, but the timing of the language
> setting is wrong.
>
> I have an User model, which has a column, 'language', so that users can
> choose their default language. When each user logged in, the
> applications should always apply itself the language of his/her choice.
>
> Say, an user wishes to change the default language from Japanese to
> French. The user inputs the new language of his/her choice in the
> setting page and hits 'save'. The app jumps to to the top page having a
> flash message appeared, 'Your setting is updated' but in JAPANESE.
> Since the user has just changed the language, the flash is also to be
> shown in French.
I'm pretty sure this is because the flash message is looked up *before* you
change the domain and stored in the session. You can get the correct locale by
doing something like:
I18n.t('my.flash.message', :locale => user.language)
In the controller before you redirect.
HTH,
Chris
---
Chris McGrath
http://www.localeapp.com
--
You received this message because you are subscribed to the Google Groups
"rails-i18n" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rails-i18n?hl=en.