Forum: Rails I18n Argument Error

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.
Anton K. (Guest)
on 2009-04-13 21:00
I used this guide: guides.rubyonrails.org/i18n.html to localize my
sample application

i've set config/environment.rb, controllers/application.rb as it is
written in the article

#views/home/index.html.erb
<h1><%=t :hello_world %></h1>

but when I start application the following error occurs:

ArgumentError in Home#index
Showing app/views/home/index.html.erb where line #1 raised:


How to avoid this error?

I'm using Mongrel/Apache and my rails configuration is:

Ruby version  1.8.6 (i386-mswin32)
RubyGems version  1.3.1
Rails version  2.2.2
Active Record version  2.2.2
Action Pack version  2.2.2
Active Resource version  2.2.2
Action Mailer version  2.2.2
Active Support version  2.2.2

Please, help me :-)
Anton K. (Guest)
on 2009-04-13 21:03
I forgot to say:
#config/locales/en.yml
en:
  hello_world: "Hello world"

#config/locales/es.yml
es:
  hello_world: "Hola Mundo"

ArgumentError in Home#index

Showing app/views/home/index.html.erb where line #1 raised:

syntax error on line 1, col 13: `  hello_world: "Hola Mundo"'
Extracted source (around line #1):

1: <h1><%=t :hello_world %></h1>
RAILS_ROOT: C:/ir/rails_apps/new

C:/ir/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
C:/ir/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
C:/ir/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:191:in
`load_yml'
C:/ir/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:178:in
`send'
C:/ir/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb:178:in
`load_file'
C:/ir/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:/ir/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:/ir/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:/ir/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:/ir/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:/ir/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:/ir/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n.rb:160:in
`translate'
C:/ir/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/translation_helper.rb:8:in
`t'
app/views/home/index.html.erb:1
This topic is locked and can not be replied to.