Query / Generate Rails I18n Locale for TextMate.
Works for erb, slim and haml.
Make sure i18n gem is installed.
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/luikore/I18n-t.tmbundle.git
The key is option + L (you can change)
Then we get
Then we get
and the new key inserted into en.yml in the right position
Assume t('hello.world.title') == t('global') == 'Title'
Then we get
Add environment variable EN_YML_FILE for output path (relative to config/locales
).
For example, EN\_YML_FILE=new-key.yml
will direct the output of new generated key to config/locales/new-key.yml
.
TextMate support lib is broken in Ruby 1.9.
To replace it for 1.8 and 1.9 compatibilities:
cd /Applications/TextMate.app/Contents/SharedSupport/Support/
mv lib lib.bak
wget cloud.github.com/downloads/luikore/I18n-t.tmbundle/lib.tgz
tar -zxvf lib.tgz