Web Translate It
This is a gem providing tools to integrate your software to translate with Web Translate It, a web-based translation hub.
This gem provides your app with:
- an executable,
wti, to upload and download language files from the command line (or in whatever else you want to execute it)
- a handful of rake task to fetch and upload your translations.
- a rack middleware to automatically fetch new translations from Web Translate It.
gem install web_translate_it
That’s it! At this point you have the Web Translate It executable.
If your project if already set up on Web Translate It, run
wti autoconf to generate the configuration file.
wti --help to see the usage:
Web Translate It Help: ********************** pull Pull language file(s) from Web Translate It. push Push language file(s) to Web Translate It. autoconf Configure your project to sync with Web Translate It. OPTIONAL PARAMETERS: -------------------- -l --locale The ISO code of a specific locale to pull or push. -c --config Path to a translation.yml file. If this option is absent, looks for config/translation.yml. --force Force `wti pull` to re-download the language file, regardless if local version is current. OTHER: ------ -v --version Show version. -h --help This page.
Specific tools for Ruby on Rails
This gem includes some rake tasks and a rack middleware to integrate Web Translate It with Ruby on Rails.
Add to your config/environments.rb:
Copy/paste your api key from Web Translate It and run:
script/generate webtranslateit --api-key your_key_here
The generator does two things:
- It adds a auto-configured
config/translation.ymlfile using Web Translate It’s API.
- It adds
require 'web_translate_it/tasks' rescue LoadErrorto your
- It adds a auto-configured
Rake tasks provided
There are 3 rake tasks.
Fetch the latest translations for all your files for all languages defined in Web Translate It’s interface, except for the languages set in
Fetch the latest translations for all the languages defined in Web Translate It’s interface. It takes the locale name as a parameter
Upload to Web Translate It your files in a specific locale defined in Web Translate It’s interface.
Read more about Rails integration in the wiki.
Supported Rails Versions
The gem currently has been tested against the following versions of Rails:
Please open a discussion on our support site if you're using a version of Rails that is not listed above and the gem is not working properly.
- The executable is very much inspired from the awesome Gemcutter commands,
- The Rails generator has been pinched from Hoptoad Notifier.
What is Web Translate It anyway?
Web Translate It is a web-based translation hub to collaboratively translate software.
To learn more about it, please visit our tour page.
This gem is released under the MIT License.