diff options
author | Raine Virta <rane@kapsi.fi> | 2009-03-02 04:01:38 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-03-03 20:52:11 +0100 |
commit | 52c9564c96dbf95e5c883e41940527f2394ba55a (patch) | |
tree | 2720cf80aa68c5df385c8f56ac512b2fbf9b44b0 /data/rbot/plugins/games | |
parent | a1e4d79615a4332f86d60dbfcd155cf6a9a46dd3 (diff) |
hangman: make replies more compatible with gettext
_() returns frozen strings in 1.92.0. This patch not only addresses
that, but also makes some of the replies more flexible.
Diffstat (limited to 'data/rbot/plugins/games')
-rw-r--r-- | data/rbot/plugins/games/hangman.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/data/rbot/plugins/games/hangman.rb b/data/rbot/plugins/games/hangman.rb index d571fd78..dbabb72c 100644 --- a/data/rbot/plugins/games/hangman.rb +++ b/data/rbot/plugins/games/hangman.rb @@ -365,16 +365,17 @@ class HangmanPlugin < Plugin end if game.over? - str = if game.won? + sentence = if game.won? _("you nailed it!") elsif game.lost? _("you've killed the poor guy :(") end - str << _(" go #{Bold}again#{Bold}?") + again = _("go #{Bold}again#{Bold}?") + scores = [] game.scores.each do |user, score| - str << " #{user.nick}: " + str = "#{user.nick}: " str << if score > 0 Irc.color(:green)+'+' elsif score < 0 @@ -383,9 +384,13 @@ class HangmanPlugin < Plugin str << score.round.to_s str << Irc.color + + scores << str end - m.reply str, :nick => true + m.reply _("%{sentence} %{again} %{scores}") % { + :sentence => sentence, :again => again, :scores => scores + }, :nick => true if rand(5).zero? m.reply _("wondering what that means? try ´%{prefix}define´") % { |