Saturday, December 6, 2008

Translate your language with Google::Translate

require 'rubygems'
require 'google_translate'

tr = Google::Translate.new

# from English to German
tr.translate :from => "en", :to => "de", :text => "Hello, World!"

# => "Hallo, Welt!"

# from English to Spanish
tr.translate :from => "en", :to => "es", :text => "Hello, World!"

# => "Hola, mundo!"

No comments: