Perhaps Object#with_options plus the :locale param could be helpful.
Something like
I18n.locale = :en
# English
t(:"welcome")
with_options(:locale => :fr) do |trans|
# French
trans.t(:"hello")
end
# English
t(:"goodbye")
Or define a method like
def self.in_locale(locale)
old_locale = I18n.locale
I18n.locale = locale
yield
ensure
I18n.locale = old_locale
end
and you could do stuff like
I18n.locale = :en
# English
t(:"welcome")
I18n.in_locale(:fr) do
# French
t(:"hello")
end
# English
t(:"goodbye")
On Fri, Aug 5, 2011 at 00:33, hydrozen <[email protected]> wrote:
> Hi,
>
> I'm working on a little content management system where the user can
> manage content that is translated in multiple languages. The UI of the
> CMS itself is also available in multiple languages so I need to be
> able to display the UI in english while the user is managing french
> content. I am not sure of the smart way to handle this. Using
> something like Globalize3 you end up having to keep switching the
> value of I18n.locale back and forth when calling I18n.translate for
> the UI or when displaying data from the model.
>
> Anyone has tips or ideas?
>
> --
> 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.
>
>
--
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.