]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/translator.rb
lastfm: allow bolding in translations in nowplaying
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / translator.rb
index 513940979b716ff2f1925054e0dd8c4c49750e55..0e09cb4855e717dd81473ead737443331570accd 100644 (file)
@@ -39,7 +39,7 @@ class Translator
     @cache = cache
   end
 
+
   # whether the translator supports this direction
   def support?(from, to)
     from != to && @directions[from].include?(to)
@@ -116,7 +116,9 @@ class NiftyTranslator < Translator
   end
 
   def do_translate(text, from, to)
-    @form.radiobuttons_with(:name => 'langpair').first.value = "#{from},#{to}".upcase
+    @radio = @form.radiobuttons_with(:name => 'langpair').first
+    @radio.value = "#{from},#{to}".upcase
+    @radio.check
     @form.fields_with(:name => 'sourceText').last.value = text
 
     @form.submit(@form.buttons_with(:name => 'translate').last).
@@ -228,13 +230,13 @@ class BabelfishTranslator < Translator
   end
 
   def do_translate(text, from, to)
-    if @form.fields_with(:name => 'trtext').first.empty?
+    if @form.fields_with(:name => 'trtext').empty?
       @form.add_field!('trtext', text)
     else
       @form.fields_with(:name => 'trtext').first.value = text
     end
     @lang_list.value = "#{from}_#{to}"
-    @form.submit.parser.search("td.s/div[@style]").inner_html
+    @form.submit.parser.search("div[@id='result']/div[@style]").inner_html
   end
 end
 
@@ -314,7 +316,7 @@ class TranslatorPlugin < Plugin
   end
 
   def update_default
-    @default_translators = bot.config['translator.default_list'] & @translators.keys 
+    @default_translators = bot.config['translator.default_list'] & @translators.keys
   end
 
   def cmd_translator(m, params)