ATTENTION: This project is not maintained anymore.
Rails plugin that make possible to use GetText ranslations in javascipt.
GettextJson can be installed as a gem :
gem install gettext_json
Or directly as a Rails plugin :
./script/plugin install git://github.com/simonc/gettext_json.git
Or as a dependency of your Rails app :
# config/environment.rb config.gem "gettext_json", :version => ">= 0.0.2" # and then in the console rake gems:install
To install the GettextJson files in your application use the following generator :
It will create three files :
lib/tasks/gettext_json.rake contains the
makemo:json rake task.
Getting the translations
To create the translations file, use the following rake task :
It will generate the
To make the GetText translations work, you need to call this file in your layout.
Use it in your scripts
To translate strings in your scripts, simply use the GetText micro library API :
GetText.locale = 'fr'; // To set the current locale (default is 'en') var str = GetText.t('Hello World'); //=> "Bonjour le Monde"
Copyright (c) 2009 Simon COURTOIS, released under the MIT license