Skip to content

Commit

Permalink
beter hack for i18n, now setting FastGettext.locale will always chang…
Browse files Browse the repository at this point in the history
…e I18n.locale
  • Loading branch information
grosser committed Jun 19, 2010
1 parent c19bd25 commit aff144d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/gettext_i18n_rails/i18n_hacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@ module I18n

def locale=(new_locale)
FastGettext.locale = new_locale
# since Rails 2.3.8 a config object is used instead of just .locale
if I18n.respond_to?(:config)
I18n.config.locale = locale
end
end

def locale
FastGettext.locale.to_sym
end
end

# since Rails 2.3.8 a config object is used instead of just .locale
if defined? Config
class Config
def locale
FastGettext.locale.to_sym
end

def locale=(new_locale)
FastGettext.locale=(new_locale)
end
end
end
end

0 comments on commit aff144d

Please sign in to comment.