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

View file

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