Rails 2.3.9 i18n - multiple yml files

Hi,

Have been following the i18n guide (
http://guides.rubyonrails.org/i18n.html
)

Things are working in a basic way, using the simple backend, with my
en.yml and pt.yml locale files.

I got the core Rails Portuguese localisation from the rails-i18n
project on github.

In order to get it being used I had to copy into my pt.yml file.

However this seems to cause a clash my model specific activerecord
items - they are in the file before the defaults and so when it loads,
when it loads the standard activerecord: errors bit, it loses mine.

Fine, sounds like perhaps I should put things in separate files,
right?

But when I put them in separate files, eg config/locales/defaults/
pt.yml - for the rails-i18n file and config/locales/pt.yml for app
specific translations. Also adding this line to environment.rb:

config.i18n.load_path += Dir[Rails.root.join(‘config’, ‘locales’,
‘**’, ‘*.{rb,yml}’)]

It does not find the defaults file - I get the Symbol not found error
(due to a date lookup, missing the localised date items…)

I looked at the i18n demo app ( http://github.com/clemens/i18n_demo_app
), but thats a bit old now and does not use nested/merged localisation
dictionaries.

Any thoughts on where I am going wrong?

Thanks in advance,
Chris

Can you show us a Gist or pastie.org with your .yml files?

Hi,

Sure - here is a sample app that has what I am trying to do in it:

http://github.com/kimptoc/Rails-i18n-sample-with-multiple-merged-yml-files

But that works… doh!

Guess I need to look at my main app again.

Apologies for wasting your time,
Chris

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs