Forum: Rails I18n undefined method i18n

Posted by Akira Yokokawa (akira-y)
on 2010-05-05 13:33
I have tried to boot WEBrick, though I suffered the problem like i18n
method not found.
How can I recover from this problem?

$ ruby script/server
=> Booting WEBrick...
/home/user/ror/design_qr/config/environment.rb:56: undefined method
`i18n' for #<Rails::Configuration:0xb77ce3ec> (NoMethodError)
  from
./script/../config/../vendor/rails/railties/lib/initializer.rb:91:in
`run'
  from /home/user/ror/design_qr/config/environment.rb:19
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  from
/home/user/ror/design_qr/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
`require'
  from
/home/user/ror/design_qr/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in
`new_constants_in'
  from
/home/user/ror/design_qr/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
`require'
  from
/home/user/ror/design_qr/vendor/rails/railties/lib/commands/servers/webrick.rb:59
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  from
/home/user/ror/design_qr/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
`require'
  from
/home/user/ror/design_qr/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in
`new_constants_in'
  from
/home/user/ror/design_qr/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
`require'
  from
/home/user/ror/design_qr/vendor/rails/railties/lib/commands/server.rb:39
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  from script/server:3


Hope it would be your help to understand the problem.

$ gem list

*** LOCAL GEMS ***

actionmailer (2.2.3)
actionpack (2.2.3)
activerecord (2.2.3)
activeresource (2.2.3)
activesupport (2.2.3)
amatsuda-i18n_generators (0.6.0)
gettext (2.1.0)
i18n (0.3.7)
locale (2.0.5)
rails (2.2.3)
rake (0.8.7)



thanks
Posted by Andrés Gutiérrez (andresgutgon)
on 2010-05-05 14:03
(Received via mailing list)
The first "i" is uppercase => I18n.t('your.traduction')

2010/5/5 Akira Yokokawa <lists@ruby-forum.com>
Posted by Akira Yokokawa (akira-y)
on 2010-05-06 09:40
Andrés Gutiérrez wrote:
> The first "i" is uppercase => I18n.t('your.traduction')
> 
> 2010/5/5 Akira Yokokawa <lists@ruby-forum.com>

Thank you for your comment.
I have changed from "i18n" to "I18n" but the problem is still remaining.
the problem happens on the following line.


  # The internationalization framework can be changed to have another 
default locale (standard is :en) or more load paths.
  # All files from config/locales/*.rb,yml are added automatically.
  # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', 
'*.{rb,yml}')]
  config.i18n.default_locale = :ja


Can you give me another solution?


Thanks
Posted by Sven Fuchs (Guest)
on 2010-05-06 09:51
(Received via mailing list)
On May 6, 2010, at 9:40 AM, Akira Yokokawa wrote:
>  # The internationalization framework can be changed to have another 
> default locale (standard is :en) or more load paths.
>  # All files from config/locales/*.rb,yml are added automatically.
>  # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', 
> '*.{rb,yml}')]
>  config.i18n.default_locale = :ja

This is part of your config/environment.rb file and the config object 
here is the Rails::Configuration.

If the Rails::Configuration object does not respond to :i18n (as the 
error trace suggests that you've posted) then by any chance are you 
trying to run an existing Rails application with an outdated Rails 
version (such as Rails < 2.1)?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.