Javascript Localize

INSTALL:

$ ./script/plugin install git://github.com/jinzhu/locale_javascript.git

How To Use:

1. drop all localized content into RAILS_ROOT/js_locales/
e.g:
  RAILS_ROOT/js_locales/en.yml
    hello world : 'Hello World!'
    hello world for you : '{{you}},Hello World!'

  RAILS_ROOT/js_locales/zh.yml
    hello world : '世界你好!'
    hello world for you : '{{you}},世界你好!'

2. include into views
 <%= include_localized_javascript %>

3. Use it as javascript
 _('hello world')                                 => en: 'Hello World!'               zh: '世界你好!'
 _('hello world for you',{you : 'ZhangJinzhu'})   => en: 'ZhangJinzhu,Hello World!'   zh: 'ZhangJinzhu,世界你好!'

4. Rake Task
 rake js_locale:sync  => Keep localized content in sync with default locale
 rake js_locale:build => Generate javascript localization files

Author : ZhangJinzhu GitHub : http://github.com/jinzhu Email : wosmvp (no-spam) gmail (no-spam) com