I can't make i18n work on rails

Hi,

I’m following this guide Rails Internationalization (I18n) API — Ruby on Rails Guides

but I can’t make it works.

it says: “Rails adds all .rb and .yml files from the config/locales
directory to your translations load path, automatically. The default
en.yml locale in this directory contains a sample pair of translation
strings”

firstly when I create a rails app using the rails command it doesn’t
not create nether a config/locales directory nor en.yml file.

secondly I want to change default language, I added this line to
enviroment.rb as the guide says

config.i18n.default_locale = :en

but it gives me an error: undefined method `i18n’ for
#Rails::Configuration:0xb78ac64c

Please I need a hand with this.

On Fri, Jan 22, 2010 at 01:19, Omar R. [email protected]
wrote:

firstly when I create a rails app using the rails command it doesn’t
not create nether a config/locales directory nor en.yml file.

I just tried generating a new Rails app with Rails 2.3.5. I got a
config/locales/en.yml file.

secondly I want to change default language, I added this line to
enviroment.rb as the guide says

config.i18n.default_locale = :en

but it gives me an error: undefined method `i18n’ for
#Rails::Configuration:0xb78ac64c

Works fine for me. What Rails version are you using? Does the top if
yopur environment.rb file say

Specifies gem version of Rails to use when vendor/rails is not present

RAILS_GEM_VERSION = ‘2.3.5’ unless defined? RAILS_GEM_VERSION

?

mine says:

RAILS_GEM_VERSION = ‘2.1.0’ unless defined? RAILS_GEM_VERSION

this should be the problem, aparrently rails command used without
version argument uses 2.1.0 as default.

Thanks a lot Henrik!

You need to run gem update to get a later version of rails

Justin

I still have problems,

I did gem update, then gem list looks like this:

$ gem list

*** LOCAL GEMS ***


rails (2.3.5, 2.3.4)

Despite it, when a do rails project-name, the config/enviroment.rb has
RAILS_GEM_VERSION = ‘2.1.0’ unless defined? RAILS_GEM_VERSION.

I have netbeans6.8 installed, I don’t know if it has its own version
of rails and in somehow is replacing 2.3.5 …

Thanks

Your top enviroment.rb says this:
RAILS_GEM_VERSION = ‘2.1.0’ unless defined? RAILS_GEM_VERSION.

Should say this:
RAILS_GEM_VERSION = ‘2.3.5’ unless defined? RAILS_GEM_VERSION.

Change it.

2010/2/1 Omar R. [email protected]


On Jan 31, 11:08 pm, Justin MacCarthy [email protected] wrote:

this should be the problem, aparrently rails command used without

I just tried generating a new Rails app with Rails 2.3.5. I got a
Works fine for me. What Rails version are you using? Does the top if
Groups “rails-i18n” group.
You received this message because you are subscribed to the Google G.
“rails-i18n” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rails-i18n?hl=en.


Experiencia es lo que obtienes, cuando no obtienes lo que quieres.