From 52c9564c96dbf95e5c883e41940527f2394ba55a Mon Sep 17 00:00:00 2001 From: Raine Virta Date: Mon, 2 Mar 2009 04:01:38 +0200 Subject: [PATCH] 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. --- data/rbot/plugins/games/hangman.rb | 13 +++++++++---- 1 file 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´") % { -- 2.39.2