Forum: Rails I18n i18n error with Rails 2.2.2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D8f444b5c1b0304a2b98d5b16da0f2f1?d=identicon&s=25 Jeba Momin (zeba)
on 2009-02-13 10:24
hi,
I'm using i18n with Rails 2.2.2 to internationalize my rails
application.
I've followed the steps as specified at:
http://www.railsrocket.com/articles/wp-content/upl...

But ...I get the following error when I try to run it:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.inject
1:
2: <h2><%= I18n.t :hello_world  %></h2>
3: <br />
4: <h2><%= I18n.t :hello_everyone %></h2>
5:
RAILS_ROOT: E:/i18n
Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:208:in
`deep_symbolize_keys'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:199:in
`merge_translations'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:179:in
`load_file'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:179:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:179:in
`load_file'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:13:in
`load_translations'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:13:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:13:in
`load_translations'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:79:in
`init_translations'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:94:in
`lookup'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:33:in
`translate'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n.rb:160:in
`t'
app/views/main/index.rhtml:2



Can anyone please tell me..how can I correct this...
Thank You...
9650515c4c5d1bd8680195d6f5d072e8?d=identicon&s=25 Frantisek Psotka (fero)
on 2009-03-18 20:48
hi i'have got same problem and adjusting en.yml have fixed it. the my
issue was:

en:

means empty localization file, i have changed it to:

en:
  foo:

and now it seems it works...


Jeba Momin wrote:
> hi,
> I'm using i18n with Rails 2.2.2 to internationalize my rails
> application.
> I've followed the steps as specified at:
> 
http://www.railsrocket.com/articles/wp-content/upl...
>
> But ...I get the following error when I try to run it:
> You have a nil object when you didn't expect it!
> You might have expected an instance of Array.
> The error occurred while evaluating nil.inject
> 1:
> 2: <h2><%= I18n.t :hello_world  %></h2>
> 3: <br />
> 4: <h2><%= I18n.t :hello_everyone %></h2>
> 5:
> RAILS_ROOT: E:/i18n
> Application Trace | Framework Trace | Full Trace
>
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:208:in
> `deep_symbolize_keys'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:199:in
> `merge_translations'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:179:in
> `load_file'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:179:in
> `each'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:179:in
> `load_file'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:13:in
> `load_translations'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:13:in
> `each'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:13:in
> `load_translations'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:79:in
> `init_translations'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:94:in
> `lookup'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:33:in
> `translate'
> 
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n.rb:160:in
> `t'
> app/views/main/index.rhtml:2
>
>
>
> Can anyone please tell me..how can I correct this...
> Thank You...
This topic is locked and can not be replied to.