ryco / rails-i18n forked from svenfuchs/rails-i18n

Repository for collecting Locale data for Ruby on Rails I18n as well as other interesting, Rails related I18n stuff

This URL has Read+Write access

yaroslav (author)
Tue Jan 27 09:43:09 -0800 2009
Reza (committer)
Mon Apr 20 07:07:43 -0700 2009
commit  89ce854dd6bede7ec61488a798a10063526e4010
tree    dee85b8687dbc1c27e77afc34331f4be1ed8191c
parent  748ad51ac8dea867c1ca165ed9eaf9a613919d70
name age message
file .gitignore Sat Jan 10 14:16:07 -0800 2009 add missing sentances to pass test of structure... [tsechingho]
file README.textile Loading commit data...
directory rails/
directory tools/ Mon Dec 29 10:42:45 -0800 2008 Added Lookup Translation to the TextMate bundle... [phorsfall]
README.textile

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.

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 rails/test/structure.rb [your-locale]

Assuming that there is a file rails/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.

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)

  1. expects you to have a string selected (including single or double quotes)
  2. prompts you for a dot-separated key
  3. opens the file /log/translations.yml (creating it when not available)
  4. adds the translation (mapping the dot-separated key to nested yaml keys)
  5. 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:

  1. hit cmd-f and give it ("|').*(\1) as a search expression, tell it to use this as a “Regular expression”
  2. hit return and it will select the next string
  3. use shift-cmd-e to extract that string
  4. hit cmd-g to select the next string