Forum: Rails I18n undefined method 'clear'

Ea5431bf6667ec86bdb9e23a37a39096?d=identicon&s=25 Sebastian (Guest)
on 2010-09-07 08:52
(Received via mailing list)
Hi folks.

I tried to get Rails I18n running with gettext, but without success.
I'm using Rails 2.3.8, i18n 0.4.1 and gettext 2.1.0.

I added the following lines to environment.rb:

config.gem "locale"
config.gem "locale_rails"
config.gem "gettext"
config.gem "gettext_activerecord"
config.gem "gettext_rails"
config.i18n.default_locale = :de

To the application controller I added:

init_gettext "my_app"

I set up the remaining things (rake tasks to generate and update po/mo
files). Fired up the server getting this result when trying to visit
any page:

NoMethodError in StaticController#index

undefined method `clear' for I18n::Locale:Module

/Library/Ruby/Gems/1.8/gems/locale_rails-2.0.5/lib/locale_rails/
i18n.rb:34:in `locale='
/Library/Ruby/Gems/1.8/gems/locale_rails-2.0.5/lib/locale_rails/
action_controller/base.rb:43:in `init_locale'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/
callbacks.rb:178:in `send'
..
..

Any ideas what's going wrong?

Thanks for your help in advance.

Sebastian
3399520f470b010c2456f448d2570e87?d=identicon&s=25 Franco Sellitto (sellittf)
on 2010-09-16 12:25
Hi Sebastian,

I had the same problem and I found the solution here:
https://rubyforge.org/tracker/index.php?func=detai...

Waiting for a locale_rails gem > 2.0.5, that maybe will include the fix,
I just replaced directly this file:
http://github.com/mutoh/locale_rails/blob/2bad6066...

where basically each relative Locale reference is now absolute as
::Locale

Bye
Franco Sellitto
This topic is locked and can not be replied to.