This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Mon Jun 15 14:52:21 -0700 2009 | |
| |
MIT-LICENSE | Mon Jun 15 23:43:34 -0700 2009 | |
| |
README | Tue Jun 16 00:14:11 -0700 2009 | |
| |
lib/ | Mon Jun 15 14:52:21 -0700 2009 | |
| |
ruby_translate.gemspec | Mon Jun 15 23:43:34 -0700 2009 |
README
RubyTranslate provides a simple wrapper around the Google Translate API for detecting and translating languages.
Usage:
gem install sermoa-ruby_translate
require 'ruby_translate'
Detect:
RubyTranslate.detect("Mein Luftkissenfahrzeug ist voller Aale")
=> "de"
RubyTranslate.detect("Safisha viatu yangu mara moja!")
=> "sw"
Translate:
RubyTranslate.translate("Mein Luftkissenfahrzeug ist voller Aale", "en")
=> "My hovercraft is full of eels"
RubyTranslate.translate("Il y a un singe qui vole dans l'arbre.", "en")
=> "There is a flying monkey in the tree."
RubyTranslate.translate("They are singing in St Peter's Square", "it")
=> "Essi sono il canto, in Piazza San Pietro"
RubyTranslate.translate("Eu queria um outro pedacinho de Apfelstrudel, por favor", "sv", "pt")
=> "Jag ville ha en bit av Apfelstrudel, tack"
languages = ["it", "fr", "de", "es", "pt", "ru", "pl"]
languages.each{|language| puts RubyTranslate.translate("All human beings are born free and equal in dignity and
rights.", language, "en")}
Tutti gli esseri umani nascono liberi ed eguali in dignità e diritti.
Tous les êtres humains naissent libres et égaux en dignité et en droits.
Alle Menschen sind frei geboren und gleich an Würde und Rechten.
Todos los seres humanos nacen libres e iguales en dignidad y derechos.
Todos os seres humanos nascem livres e iguais em dignidade e em direitos.
Все люди рождаются свободными и равными в своем достоинстве и правах.
Wszyscy ludzie rodzą się wolni i równi pod względem swej godności i swych praw.
Note that the 'from' parameter is optional - if you do not provide it, RubyTranslate first uses detect to guess which
language it is.
Acknowledgements:
Thanks to the following excellent sources for inspiration:
* http://ruby.geraldbauer.ca/google-translation-api.html
* http://github.com/elisehuard/google_translate/tree/master
* http://github.com/sishen/rtranslate/tree/master
* http://www.omniglot.com/language/phrases/hovercraft.htm
* http://www.omniglot.com/language/phrases/useful.htm
* http://www.un.org/en/documents/udhr/







