# Localization in a structured hierarchy of .yml files

**URL:** <https://www.ruby-forum.com/t/localization-in-a-structured-hierarchy-of-yml-files/195489>\
**Category:** Rails I18n\
**Created:** [September 23, 2010, 8:06pm UTC](https://www.ruby-forum.com/t/localization-in-a-structured-hierarchy-of-yml-files/195489 "2010-09-23T20:06:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [September 23, 2010, 8:06pm UTC](https://www.ruby-forum.com/t/localization-in-a-structured-hierarchy-of-yml-files/195489/1 "2010-09-23T20:06:21Z")

</div>

[Rails 3, Ruby 1.9.2]  
I tried to split my localizations into a structured hierarchy of  
files :

default  
en.yml  
fr.yml  
de.yml  
models  
users  
en.yml  
fr.yml  
de.yml  
views  
users  
en.yml  
fr.yml  
de.yml

but this doesn’t get loaded ?  
I tried config.i18n.load\_path += Dir[Rails.root.join(‘config’,  
‘locales’, ‘\*.{rb,yml}’).to\_s]

but this doesn’ help …  
how can I get all these loaded ?

thanks for your suggestions

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [September 23, 2010, 8:23pm UTC](https://www.ruby-forum.com/t/localization-in-a-structured-hierarchy-of-yml-files/195489/2 "2010-09-23T20:23:55Z")

</div>

2010/9/23 Erwin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> ```
> en.yml
> 
> ```
> 
> ‘locales’, ‘_.{rb,yml}').to\_s]  
> config.i18n.load\_path +=  
> Dir[Rails.root.join('config/locales/\*\*/_.{rb,yml}’).to\_s] ?

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [September 23, 2010, 11:04pm UTC](https://www.ruby-forum.com/t/localization-in-a-structured-hierarchy-of-yml-files/195489/3 "2010-09-23T23:04:20Z")

</div>

Thanks Krzysztof,

That’s what I tested … but it gives me an ArgumentError  
------------ console --------------  
$ rails c  
Loading development environment (Rails 3.0.0)  
ruby-1.9.2-p0 \> I18n.t(:buddy)  
ArgumentError: syntax error on line 43, col 3: `common:' from /Users/yves/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/syck.rb: 135:in`load’

:buddy is in config/locales/defaults/en.yml and config/locales/  
defaults/fr.yl

is there any way to check what’s loaded and how ?

Erwin

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [September 23, 2010, 11:20pm UTC](https://www.ruby-forum.com/t/localization-in-a-structured-hierarchy-of-yml-files/195489/4 "2010-09-23T23:20:44Z")

</div>

The config.i18n.load\_path is correct …  
I listed this array all files are there …  
there is an error in one of the files given with the Devise gem…

thanks a lot
