module I27r::BabelFish
Public Instance Methods
_translate(word, lang)
click to toggle source
# File lib/generators/i18n_translation/lib/translator.rb, line 13 def _translate(word, lang) require 'mechanize' w = CGI.escape ActiveSupport::Inflector.humanize(word) agent = Mechanize.new url = "http://babelfish.yahoo.com/translate_txt?lp=en_#{lang}&trtext=#{w}" page = agent.get(url) page.search('#result div').text end