Babel: Automatic language translation
Babel is tiny library for translating between languages using Google’s automatic language translation (more info).
Installation
sudo gem install rbabel
Usage
require 'rbabel'
Babel.translate("hello", :en, :fr) #=> "Bonjour"
You can also translate a text into multiple languages by supplying multiple destination languages:
Babel.translate("hello", :en, :fr, :it) #=> ["Bonjour", "Ciao"]
Babel extends String with a #translate method for convenience:
"hello".translate(:en, :fr) #=> "Bonjour"
"hello".translate(:en, :fr, :it) #=> ["Bonjour", "Ciao"]
Command line utility
Babel can also be used as a command line utility that translates stdin to stdout. Example usage:
cat english.txt | rbabel en:fr > french.txt
Contact
If you have any comments or suggestions please send an email to ciconia at gmail.com and I’ll get back to you.