]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
hangman: enable gettext on some replies and help
authorRaine Virta <rane@kapsi.fi>
Mon, 2 Mar 2009 02:04:35 +0000 (04:04 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 3 Mar 2009 19:52:11 +0000 (20:52 +0100)
data/rbot/plugins/games/hangman.rb

index dbabb72c6fbb98520c5c4a6a552ae81d17b2756a..c5d7656fe3f5f31a5555525246bcd8f5ba3e33d0 100644 (file)
@@ -242,15 +242,15 @@ class HangmanPlugin < Plugin
   def help(plugin, topic="")
     case topic
     when ""
-      return "hangman game plugin - topics: play, stop"
+      return _("hangman game plugin - topics: play, stop")
     when "play"
-      return "hangman play on <channel> with word <word> => use in private chat with the bot to start a game with custom word\n"+
-             "hangman play random [with [max|min] length [<|>|== <length>]] => hangman with a random word from #{RandomWord::SITE}\n"+
-             "hangman play with wordlist <wordlist> => hangman with random word from <wordlist>"
+      return [_("hangman play on <channel> with word <word> => use in private chat with the bot to start a game with custom word\n"),
+              _("hangman play random [with [max|min] length [<|>|== <length>]] => hangman with a random word from %{site}\n"),
+              _("hangman play with wordlist <wordlist> => hangman with random word from <wordlist>")].join
     when "stop"
-      return "hangman stop => quits the current game"
+      return _("hangman stop => quits the current game")
     when "define"
-      return "define => seeks a definition for the previous answer using google"
+      return _("define => seeks a definition for the previous answer using google")
     end
   end
 
@@ -261,7 +261,7 @@ class HangmanPlugin < Plugin
       begin
         wordlist = Wordlist.get(params[:wordlist].join("/"), :spaces => true)
       rescue
-        raise "no such wordlist"
+        raise _("no such wordlist")
       end
 
       wordlist[rand(wordlist.size)]
@@ -282,7 +282,7 @@ class HangmanPlugin < Plugin
         unless words.empty?
           words.first
         else
-          m.reply "suitable word not found in the set"
+          m.reply _("suitable word not found in the set")
           nil
         end
       else
@@ -371,7 +371,7 @@ class HangmanPlugin < Plugin
           _("you've killed the poor guy :(")
         end
 
-        again = _("go #{Bold}again#{Bold}?")
+        again = _("go %{b}again%{b}?") % { :b => Bold }
 
         scores = []
         game.scores.each do |user, score|