Topic: missing translation file

Hello guys,
I'm trying to localize a Rails 2.3.4 application.

I created 2 files

config/locales/en.yml
config/locales/es.yml

and according to http://guides.rubyonrails.org/i18n.html
"Rails adds all .rb and .yml files from the config/locales directory to your translations load path, automatically."

So if I try I18n.available_locales I should get en and es, however I get only en.
Moreover If I set es as the default locale my page shows  es, home_subhead_1  es, home_subhead_2 and so on.

Am I missing something? How can I load the spanish translation?


Thanks

Last edited by macsig (2010-07-08 04:07:33)

Re: missing translation file

do your .yml files have :en or :es as the primary key?  eg

#config/locales/en.yml
en:
  hello_world: Hello
  general:
    edit: Edit
    delete: Delete

They should do.  Ultimately all the yaml files are converted into one big nested hash, with :en and :es as the top level keys, and this hash is what available_translations looks in.

Last edited by Max Williams (2010-07-08 09:27:15)

###########################################
#If i've helped you then please recommend me at Working With Rails:
#http://www.workingwithrails.com/person/ … i-williams

Re: missing translation file

Thanks for your reply.

I feel quite silly: for testing purposes I have duplicated en.yml, changed its name in es.yml and translated few sentences but I have forgot to update the top level key.


Now everything looks fine.


Thanks again