diff options
author | Karel Minarik <karmi@karmi.cz> | 2009-01-26 17:04:56 +0100 |
---|---|---|
committer | Karel Minarik <karmi@karmi.cz> | 2009-01-26 17:04:56 +0100 |
commit | 095c89baebb5b72dc126c45669512d74eec80541 (patch) | |
tree | d72d30c7494c02a1ed17731337af176ba28acd51 /railties/doc/guides | |
parent | b24f136fd418815aec88afff2a9459b91fde6dab (diff) | |
download | rails-095c89baebb5b72dc126c45669512d74eec80541.tar.gz rails-095c89baebb5b72dc126c45669512d74eec80541.tar.bz2 rails-095c89baebb5b72dc126c45669512d74eec80541.zip |
Finished the tutorial part of i18n guide (organization of locale files)
Diffstat (limited to 'railties/doc/guides')
-rw-r--r-- | railties/doc/guides/source/i18n.txt | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/railties/doc/guides/source/i18n.txt b/railties/doc/guides/source/i18n.txt index 2167e389e3..ca03808c02 100644 --- a/railties/doc/guides/source/i18n.txt +++ b/railties/doc/guides/source/i18n.txt @@ -432,10 +432,46 @@ image:images/i18n/demo_localized_pirate.png[rails i18n demo localized time to pi TIP: Right now you might need to add some more date/time formats in order to make the I18n backend work as expected. Of course, there's a great chance that somebody already did all the work by *translating Rails's defaults for your locale*. See the http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale[rails-i18n repository at Github] for an archive of various locale files. When you put such file(s) in +config/locale/+ directory, they will automatically ready for use. +=== 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. + +For example, your +config/locale+ directory could look like this: + +------------------------------------------------------- +|-defaults +|---es.rb +|---en.rb +|-models +|---book +|-----es.rb +|-----en.rb +|-views +|---defaults +|-----es.rb +|-----en.rb +|---books +|-----es.rb +|-----en.rb +|---users +|-----es.rb +|-----en.rb +|---navigation +|-----es.rb +|-----en.rb +------------------------------------------------------- + +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. + +Do check the http://rails-i18n.org/wiki[Rails i18n Wiki] for list of tools available for managing translations. == Overview of the I18n API features -The following purposes are covered: +By knowing all neccessary aspects of internationalizing a basic Ruby on Rails application, now you should have good understanding of using the i18n library. In the following chapters, we'll cover it's features in more depth. + +Covered are features like these: * lookup translations * interpolate data into translations |