-
Notifications
You must be signed in to change notification settings - Fork 0
An easy way to access the Google Translate API via Ruby.
License
aimeerivers/ruby_translate
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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/
About
An easy way to access the Google Translate API via Ruby.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published