Class: T2etranslator

Inherits:
Object
  • Object
show all
Defined in:
lib/t2etranslator.rb

Class Method Summary collapse

Class Method Details

.translate(context, default = "ta") ⇒ Object



5
6
7
8
9
# File 'lib/t2etranslator.rb', line 5

def self.translate(context, default = "ta")
  page = Nokogiri::HTML(open(URI.parse(URI.encode("http://translate.google.com/?langpair=en|#{default}&text=#{context}"))))
  result = page.search("#result_box")
  result.text
end