From beaa46f8e4aa69d0b544a9e5e58b0bb99e083e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Fri, 27 May 2016 14:03:12 +0200 Subject: [PATCH] translation issues --- bot.py | 12 +++++++----- internationalization.py | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/bot.py b/bot.py index 6ea1f9c..e6b592a 100644 --- a/bot.py +++ b/bot.py @@ -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() diff --git a/internationalization.py b/internationalization.py index 3e73ea0..9087a86 100644 --- a/internationalization.py +++ b/internationalization.py @@ -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'