From c9e63f1fdd8fe1b1e5bdf3137218e8eab526e130 Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Sun, 13 Dec 2020 11:29:57 +0100 Subject: [PATCH] localization improvements --- backend/bang/expansions/dodge_city/characters.py | 2 +- backend/bang/game.py | 8 ++++---- backend/bang/roles.py | 11 +++++++---- frontend/src/i18n/en.json | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/backend/bang/expansions/dodge_city/characters.py b/backend/bang/expansions/dodge_city/characters.py index e9c3362..c5c6ea7 100644 --- a/backend/bang/expansions/dodge_city/characters.py +++ b/backend/bang/expansions/dodge_city/characters.py @@ -47,7 +47,7 @@ class MollyStark(Character): def __init__(self): super().__init__("Molly Stark", max_lives=4) self.desc = "Quando usa volontariamente una carta che ha in mano, fuori dal suo turno, ne ottiene un'altra dal mazzo" - self.desc_eng = "When she uses a card from her hand outside her turn, he draws a card." + self.desc_eng = "When she uses a card from her hand outside her turn, she draws a card." self.icon = '🙅‍♀️' class ApacheKid(Character): diff --git a/backend/bang/game.py b/backend/bang/game.py index 12e7c42..780bd2f 100644 --- a/backend/bang/game.py +++ b/backend/bang/game.py @@ -85,7 +85,7 @@ class Game: print(self.name) print(self.players[i].name) print(self.players[i].character) - self.sio.emit('chat_message', room=self.name, data=f'_choose_character|{self.players[i].name}|{self.players[i].character.name}|{self.players[i].character.desc}') + self.sio.emit('chat_message', room=self.name, data=f'_choose_character|{self.players[i].name}|{self.players[i].character.name}|{self.players[i].character.desc}|{self.players[i].character.desc_eng}') self.players[i].prepare() for k in range(self.players[i].max_lives): self.players[i].hand.append(self.deck.draw()) @@ -114,9 +114,9 @@ class Game: available_roles: List[roles.Role] = [] if len(self.players) == 3: available_roles = [ - roles.Vice('Elimina il Rinnegato 🦅, se non lo elimini tu elimina anche il Fuorilegge'), - roles.Renegade('Elimina il Fuorilegge 🐺, se non lo elimini tu elimina anche il Vice'), - roles.Outlaw('Elimina il Vice 🎖, se non lo elimini tu elimina anche il Rinnegato') + roles.Vice('Elimina il Rinnegato 🦅, se non lo elimini tu elimina anche il Fuorilegge', 'Kill the Renegade 🦅, if you are not the one who kills him then kill the Outlaw!'), + roles.Renegade('Elimina il Fuorilegge 🐺, se non lo elimini tu elimina anche il Vice', 'Kill the Outlaw 🐺, if you are not the one who kills him then kill the Vice!'), + roles.Outlaw('Elimina il Vice 🎖, se non lo elimini tu elimina anche il Rinnegato', 'Kill the Vice 🎖, if you are not the one who kills him then kill the Renegade!') ] elif len(self.players) >= 4: available_roles = [roles.Sheriff(), roles.Renegade(), roles.Outlaw(), roles.Outlaw(), roles.Vice(), roles.Outlaw(), roles.Vice(), roles.Renegade(), roles.Outlaw(), roles.Vice(), roles.Outlaw()] diff --git a/backend/bang/roles.py b/backend/bang/roles.py index 66c9204..449de58 100644 --- a/backend/bang/roles.py +++ b/backend/bang/roles.py @@ -28,11 +28,12 @@ class Sheriff(Role): class Vice(Role): - def __init__(self, alternative_goal=None): + def __init__(self, alternative_goal=None, alternative_goal_eng=None): super().__init__("Vice", "Proteggi lo Sceriffo! Elimina tutti i Fuorilegge e il Rinnegato!") self.goal_eng = "Protect the Sheriff! Kill the Outlaws and the Renegade!" if alternative_goal: self.goal = alternative_goal + self.goal_eng = alternative_goal_eng self.max_players = 2 self.icon = '🎖' @@ -47,11 +48,12 @@ class Vice(Role): return False class Outlaw(Role): - def __init__(self, alternative_goal=None): + def __init__(self, alternative_goal=None, alternative_goal_eng=None): super().__init__("Fuorilegge", "Elimina lo Sceriffo!") - self.goal_eng = "Kill the Sheriff!" + self.goal_eng = "Kill the sSheriff!" if alternative_goal: self.goal = alternative_goal + self.goal_eng = alternative_goal_eng self.max_players = 3 self.icon = '🐺' @@ -66,11 +68,12 @@ class Outlaw(Role): return False class Renegade(Role): - def __init__(self, alternative_goal=None): + def __init__(self, alternative_goal=None, alternative_goal_eng=None): super().__init__("Rinnegato", "Rimani l'ultimo personaggio in gioco!") self.goal_eng = "Be the last man standing!" if alternative_goal: self.goal = alternative_goal + self.goal_eng = alternative_goal_eng self.max_players = 1 self.icon = '🦅' diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 1a0b619..7527a13 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -59,7 +59,7 @@ "died": "{0} died", "died_role": "{0} was a {1}!", "won": "{0} won!", - "choose_character": "{0} has {1} as character, his special ability is: {2}!", + "choose_character": "{0} has {1} as character, his special ability is: {3}!", "starting": "The game is starting!", "sheriff": "{0} is the sheriff!", "did_choose_character": "{0} did choose the character.",