h1. Rails Locale Data Repository

Central point to collect locale data for use in Ruby on Rails.

To contribute just send me a pull request, patch or plain text file. 

Please include a comment with the language/locale name and your name and email address (or other contact information like your github profile) to the locale file so people can come contact you and ask questions etc.

Also, please pay attention to save your files as UTF-8.

h2. Rails translations plugin

To include the translations of this repository into your application, simply install it as a plugin:

./script/plugin install git://github.com/zargony/rails-i18n.git

The plugin will load Rails core translations of locales you are using in your app. (i.e. if you have en.yml, de.yml and fr.yml in config/locales, Rails core locales for :de and :fr are added). These translations are added to the I18n load path before application locales, so you can still override them in your application locales.

h2. Rails translations

Simple tool for testing the integrity of your key structure:

Make sure you have the Ruby I18n gem installed. If you haven't already you can try: 

sudo gem install svenfuchs-i18n -s http://gems.github.com

Then, standing in the root directory of this repository, do:

ruby test/structure.rb [your-locale]

Assuming that there is a file locale/[your-locale].{rb,yml} you will get a summary of missing and bogus keys as well as extra pluralization keys in your locale data.

h2. Rails I18n Textmate bundle

Still in a very experimental state but already helpful for me.

The bundle adds a single command: extract translation (shift-cmd-e)

# expects you to have a string selected (including single or double quotes)
# prompts you for a dot-separated key
# opens the file /log/translations.yml (creating it when not available)
# adds the translation (mapping the dot-separated key to nested yaml keys)
# replaces the selected string in your source-code with the dot-separated key wrapped into a call to t(your.key)

It currently expects that you're working with English views, so it uses :en as a locale in translation.yml.

Note that Textmate, while active, won't reload the translations.yml for you if it's already open. When you give the focus to another application and then go back to Textmate (e.g. with cmd-tab, cmd-tab) it will reload the file. I found it useful to have translations.yml open on a second monitor while extracting translations from my application.

I still have to figure out how to automatically select the next string after this command has run. It works well to just use Textmate's "Find Next" though:

# hit cmd-f and give it <code>("|').*(\1)</code> as a search expression, tell it to use this as a "Regular expression"
# hit return and it will select the next string
# use shift-cmd-e to extract that string
# hit cmd-g to select the next string

