]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/spell.rb
grouphug plugin: tweak regex so it captures confessions with newlines properly
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / spell.rb
index 81ee1ac6553f5b3f88e303a932a3220c551faa1a..7d58b79ca8ad2945f34eebe77c01f3a2364df008 100644 (file)
@@ -1,10 +1,10 @@
 class SpellPlugin < Plugin
   def help(plugin, topic="")
-    "spell <word> => check spelling of <word>, suggest alternatives"
+    _("spell <word> => check spelling of <word>, suggest alternatives")
   end
   def privmsg(m)
     unless(m.params && m.params =~ /^\S+$/)
-      m.reply "incorrect usage: " + help(m.plugin)
+      m.reply _("incorrect usage: ") + help(m.plugin)
       return
     end
     p = IO.popen("ispell -a -S", "w+")
@@ -13,21 +13,26 @@ class SpellPlugin < Plugin
       p.close_write
       p.each_line {|l|
         if(l =~ /^\*/)
-          m.reply "#{m.params} may be spelled correctly"
+          m.reply(_("%{word} may be spelled correctly") % {:word => m.params})
+          p.close
           return
         elsif(l =~ /^\s*&.*: (.*)$/)
           m.reply "#{m.params}: #$1"
+          p.close
           return
         elsif(l =~ /^\s*\+ (.*)$/)
-          m.reply "#{m.params} is presumably derived from " + $1.downcase
+          m.reply((_("%{word} is presumably derived from ") % {:word => m.params}) + $1.downcase)
+          p.close
           return
         elsif(l =~ /^\s*#/)
-          m.reply "#{m.params}: no suggestions"
+          m.reply(_("%{word}: no suggestions") % {:word => m.params})
+          p.close
           return
         end
       }
+      p.close
     else
-      m.reply "couldn't exec ispell :("
+      m.reply _("couldn't exec ispell :(")
       return
     end
   end