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")
> --
> You received this message because you are subscribed to the Google Groups "rails-i18n" group.
> To post to this group, send email to rails...@googlegroups.com.
> To unsubscribe from this group, send email to rails-i18n+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rails-i18n?hl=en.
>
>
Make that
module I18n
def self.in_locale(locale)
...
end
end