Forum: Rails I18n Rails 2.3.9 i18n - multiple yml files

22add8fc5caab4e188b920b0283428b0?d=identicon&s=25 kimptoc (Guest)
on 2010-09-27 23:01
(Received via mailing list)
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
Adce10d7f1dbabcdab8f525a59cec32f?d=identicon&s=25 Andrés Gutiérrez (andresgutgon)
on 2010-09-28 09:25
(Received via mailing list)
Can you show us a Gist or pastie.org with your .yml files?
22add8fc5caab4e188b920b0283428b0?d=identicon&s=25 kimptoc (Guest)
on 2010-09-28 10:37
(Received via mailing list)
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-m...

But that works.. doh!

Guess I need to look at my main app again.

Apologies for wasting your time,
Chris
This topic is locked and can not be replied to.