aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/i18n.textile
diff options
context:
space:
mode:
authorKarel Minarik <karmi@karmi.cz>2009-03-01 11:03:59 +0100
committerKarel Minarik <karmi@karmi.cz>2009-03-01 11:03:59 +0100
commit48d4c0f0116117e45fd268f9fa8ae502d7f15cc7 (patch)
treedfb9421d77772c6471c7d727837c06e5f461227e /railties/guides/source/i18n.textile
parente1c0763e47f76b916324c5a062b50ede41a51e3c (diff)
downloadrails-48d4c0f0116117e45fd268f9fa8ae502d7f15cc7.tar.gz
rails-48d4c0f0116117e45fd268f9fa8ae502d7f15cc7.tar.bz2
rails-48d4c0f0116117e45fd268f9fa8ae502d7f15cc7.zip
Added note how to configure Rails loading mechanism to look for nested locale files (+config/locales/models/book/es.yml+, etc) to the I18N guide
Diffstat (limited to 'railties/guides/source/i18n.textile')
-rw-r--r--railties/guides/source/i18n.textile11
1 files changed, 8 insertions, 3 deletions
diff --git a/railties/guides/source/i18n.textile b/railties/guides/source/i18n.textile
index bb445c0bf7..bc8be1f068 100644
--- a/railties/guides/source/i18n.textile
+++ b/railties/guides/source/i18n.textile
@@ -416,7 +416,7 @@ TIP: Right now you might need to add some more date/time formats in order to mak
h4. Organization of locale files
-When you are using the default SimpleStore, shipped with the i18n library, you store dictionaries in plain-text files on the disc. Putting translations for all parts of your application in one file per locale could be hard to manage. You can store these files in a hierarchy which makes sense to you.
+When you are using the default SimpleStore, shipped with the i18n library, dictionaries are stored in plain-text files on the disc. Putting translations for all parts of your application in one file per locale could be hard to manage. You can store these files in a hierarchy which makes sense to you.
For example, your +config/locale+ directory could look like this:
@@ -443,9 +443,14 @@ For example, your +config/locale+ directory could look like this:
|-----en.rb
</pre>
-This way, you can separate model and model attribute names from text inside views, and all of this from the "defaults" (eg. date and time formats).
+This way, you can separate model and model attribute names from text inside views, and all of this from the "defaults" (eg. date and time formats). Other stores for the i18n library could provide different means of such separation.
-Other stores for the i18n library could provide different means of such separation.
+NOTE: The default locale loading mechanism in Rails does not load locale files in nested dictionaries, like we have here. So, for this to work, we must explicitely tell Rails to look further:
+
+<ruby>
+ # config/environment.rb
+ config.i18n.load_path += Dir[File.join(RAILS_ROOT, 'config', 'locales', '**', '*.{rb,yml}')]
+</ruby>
Do check the "Rails i18n Wiki":http://rails-i18n.org/wiki for list of tools available for managing translations.