Rails i18n (Internationalization) Textmate Bundle

Posted By Ryan Stout on July 31, 2010

I'm finally getting around to internationalizing my domain search tool bustaname.com. Rails has great i18n support in the form of yml locale files. The best place to get started with internationalizing your rails app is the Rails i18n Guide. Once I got the basics setup however I realized that it would be a lot of work to move all of the strings by hand and run them through google translate or MyGengo. So I made a TextMate bundle to help automate the process (as much as it can be automated). I wanted it to do a few things:

Features

  • Select text, hit a key combo (CMD+SHIFT+I - think if for Internationalize), give the string a name, then it places it into the default locale (english).
  • Have it be able to handle variables passed in through the {{variable_name}} syntax.
  • Provide a shortcut for capturing input and passing it into a variable (see video)
  • Hit CMD+SHIFT+G (G was a random choice - or maybe go for Go translate) to translate all of the untranslated strings in the default locale into another language.
    • Have an option to translate via Google Translate or MyGengo

Installing

If you have git, you can install the bundle from the projects Github page.

First install the required gems:

sudo gem install httparty ruby-hmac ya2yaml

Then clone the repository.

mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/ryanstout/rails_i18n.tmbundle.git "Rails i18n.tmbundle"
osascript -e 'tell app "TextMate" to reload bundles'

Video Tutorial

All of the features are there, and I made a video tutorial to walk you through the proces.

or watch via YouTube below.

GitHub

Please feel free to fork the project and add needed features/enhancements.

GitHub Project Page


Tags: ruby on rails, i18n, textmate

Showing 1 comment

Pedro Cunha Posted over 1 year ago

Hello, you wrote a decent bundle but it's not cool if it's ordering the keys on an existing .yml file. And your documentation is not refering this behaviour either. Is there a way to disable this behaviour?

Post a Comment