translation issues

This commit is contained in:
Jannes Höke 2016-05-27 14:03:12 +02:00
parent b8e8a7e5de
commit beaa46f8e4
2 changed files with 10 additions and 8 deletions

12
bot.py
View file

@ -507,6 +507,8 @@ def reply_to_query(bot, update):
str(card) not in added_ids))
added_ids.append(str(card))
add_gameinfo(game, results)
elif user_id != game.current_player.user.id or not game.started:
for card in sorted(player.cards):
add_card(game, card, results, can_play=False)
@ -665,21 +667,21 @@ def do_call_bluff(bot, player):
if player.prev.bluffing:
send_async(bot, chat.id,
text=__("Bluff called! Giving 4 cards to {name}",
game.translate)
.format(name=player.prev.user.first_name))
multi=game.translate)
.format(name=player.prev.user.first_name))
try:
player.prev.draw()
except DeckEmptyError:
send_async(bot, player.game.chat.id,
text=__("There are no more cards in the deck.",
game.translate))
multi=game.translate))
else:
game.draw_counter += 2
send_async(bot, chat.id,
text=__("{name1} didn't bluff! Giving 6 cards to {name2}",
game.translate)
multi=game.translate)
.format(name1=player.prev.user.first_name,
name2=player.user.first_name))
try:
@ -687,7 +689,7 @@ def do_call_bluff(bot, player):
except DeckEmptyError:
send_async(bot, player.game.chat.id,
text=__("There are no more cards in the deck.",
game.translate))
multi=game.translate))
game.turn()

View file

@ -85,7 +85,7 @@ def __(singular, plural=None, n=1, multi=False):
"""Translates text into all locales on the stack"""
translations = list()
if not multi:
if not multi and len(set(_.locale_stack)) >= 1:
_.push('en_US')
translations.append(_(singular, plural, n))
_.pop()
@ -109,7 +109,7 @@ def user_locale(func):
with db_session:
us = UserSetting.get(id=user.id)
if us:
if us and us.lang != 'en':
_.push(us.lang)
else:
_.push('en_US')
@ -132,7 +132,7 @@ def game_locales(func):
for player in player.game.players:
us = UserSetting.get(id=player.user.id)
if us:
if us and us.lang != 'en':
loc = us.lang
else:
loc = 'en_US'