Some translations were missing concerning sunflowers, fixes #44

This commit is contained in:
Yohann D'ANELLO 2020-12-12 17:39:12 +01:00
parent 73e1fac89a
commit 288a6ac2c9
8 changed files with 98 additions and 42 deletions

View File

@ -155,7 +155,7 @@ class PlayerInventoryDisplay(MenuDisplay):
""" """
We can select a menu item with the mouse. We can select a menu item with the mouse.
""" """
self.menu.position = max(0, min(len(self.menu.values) - 1, y - 3)) self.menu.position = max(0, min(len(self.menu.values) - 1, y - 2))
game.handle_key_pressed(KeyValues.ENTER) game.handle_key_pressed(KeyValues.ENTER)
@ -181,5 +181,5 @@ class StoreInventoryDisplay(MenuDisplay):
""" """
We can select a menu item with the mouse. We can select a menu item with the mouse.
""" """
self.menu.position = max(0, min(len(self.menu.values) - 1, y - 3)) self.menu.position = max(0, min(len(self.menu.values) - 1, y - 2))
game.handle_key_pressed(KeyValues.ENTER) game.handle_key_pressed(KeyValues.ENTER)

View File

@ -43,8 +43,10 @@ class Sunflower(FriendlyEntity):
""" """
A friendly sunflower A friendly sunflower
""" """
dialogue_option = [_("Flower power!!"), _("The sun is warm today")]
def __init__(self, maxhealth: int = 15, def __init__(self, maxhealth: int = 15,
*args, **kwargs) -> None: *args, **kwargs) -> None:
super().__init__(name="sunflower", maxhealth=maxhealth, *args, **kwargs) super().__init__(name="sunflower", maxhealth=maxhealth, *args, **kwargs)
@property
def dialogue_option(self):
return [_("Flower power!!"), _("The sun is warm today")]

View File

@ -474,9 +474,9 @@ class FriendlyEntity(FightingEntity):
dialogue_option: list dialogue_option: list
def talk_to(self, player: Any) -> str: def talk_to(self, player: Any) -> str:
a = randint(0, len(self.dialogue_option) - 1) return _("{entity} said: {message}").format(
return "The " + self.translated_name \ entity=self.translated_name.capitalize(),
+ " said : " + self.dialogue_option[a] message=choice(self.dialogue_option))
def keys(self) -> list: def keys(self) -> list:
""" """

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: squirrelbattle 3.14.1\n" "Project-Id-Version: squirrelbattle 3.14.1\n"
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n" "Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
"POT-Creation-Date: 2020-12-12 17:07+0100\n" "POT-Creation-Date: 2020-12-12 17:24+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -38,11 +38,11 @@ msgstr "SIE WURDEN GESTORBEN"
msgid "I don't sell any squirrel" msgid "I don't sell any squirrel"
msgstr "Ich verkaufe keinen Eichhörnchen." msgstr "Ich verkaufe keinen Eichhörnchen."
#: squirrelbattle/entities/friendly.py:46 #: squirrelbattle/entities/friendly.py:52
msgid "Flower power!!" msgid "Flower power!!"
msgstr "Blumenmacht!!" msgstr "Blumenmacht!!"
#: squirrelbattle/entities/friendly.py:46 #: squirrelbattle/entities/friendly.py:52
msgid "The sun is warm today" msgid "The sun is warm today"
msgstr "Die Sonne ist warm heute" msgstr "Die Sonne ist warm heute"
@ -101,6 +101,11 @@ msgstr "{name} nimmt {amount} Schadenspunkte."
msgid "{name} dies." msgid "{name} dies."
msgstr "{name} stirbt." msgstr "{name} stirbt."
#: squirrelbattle/interfaces.py:477
#, python-brace-format
msgid "{entity} said: {message}"
msgstr "{entity} hat gesagt: {message}"
#: squirrelbattle/menus.py:73 #: squirrelbattle/menus.py:73
msgid "Back" msgid "Back"
msgstr "Zurück" msgstr "Zurück"
@ -200,33 +205,45 @@ msgid "player"
msgstr "Spieler" msgstr "Spieler"
#: squirrelbattle/tests/translations_test.py:61 #: squirrelbattle/tests/translations_test.py:61
msgid "tiger"
msgstr "Tiger"
#: squirrelbattle/tests/translations_test.py:62
msgid "hedgehog" msgid "hedgehog"
msgstr "Igel" msgstr "Igel"
#: squirrelbattle/tests/translations_test.py:62
msgid "merchant"
msgstr "Kaufmann"
#: squirrelbattle/tests/translations_test.py:63 #: squirrelbattle/tests/translations_test.py:63
msgid "rabbit" msgid "rabbit"
msgstr "Kanninchen" msgstr "Kanninchen"
#: squirrelbattle/tests/translations_test.py:64 #: squirrelbattle/tests/translations_test.py:64
msgid "sunflower"
msgstr "Sonnenblume"
#: squirrelbattle/tests/translations_test.py:65
msgid "teddy bear" msgid "teddy bear"
msgstr "Teddybär" msgstr "Teddybär"
#: squirrelbattle/tests/translations_test.py:66 #: squirrelbattle/tests/translations_test.py:66
msgid "tiger"
msgstr "Tiger"
#: squirrelbattle/tests/translations_test.py:68
msgid "body snatch potion" msgid "body snatch potion"
msgstr "Leichenfleddererzaubertrank" msgstr "Leichenfleddererzaubertrank"
#: squirrelbattle/tests/translations_test.py:67 #: squirrelbattle/tests/translations_test.py:69
msgid "bomb" msgid "bomb"
msgstr "Bombe" msgstr "Bombe"
#: squirrelbattle/tests/translations_test.py:68 #: squirrelbattle/tests/translations_test.py:70
msgid "explosion"
msgstr "Explosion"
#: squirrelbattle/tests/translations_test.py:71
msgid "heart" msgid "heart"
msgstr "Herz" msgstr "Herz"
#: squirrelbattle/tests/translations_test.py:69 #: squirrelbattle/tests/translations_test.py:72
msgid "sword" msgid "sword"
msgstr "schwert" msgstr "schwert"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: squirrelbattle 3.14.1\n" "Project-Id-Version: squirrelbattle 3.14.1\n"
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n" "Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
"POT-Creation-Date: 2020-12-12 17:07+0100\n" "POT-Creation-Date: 2020-12-12 17:24+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -37,11 +37,11 @@ msgstr "ERES MUERTO"
msgid "I don't sell any squirrel" msgid "I don't sell any squirrel"
msgstr "No vendo ninguna ardilla" msgstr "No vendo ninguna ardilla"
#: squirrelbattle/entities/friendly.py:46 #: squirrelbattle/entities/friendly.py:52
msgid "Flower power!!" msgid "Flower power!!"
msgstr "Poder de las flores!!" msgstr "Poder de las flores!!"
#: squirrelbattle/entities/friendly.py:46 #: squirrelbattle/entities/friendly.py:52
msgid "The sun is warm today" msgid "The sun is warm today"
msgstr "El sol está caliente hoy" msgstr "El sol está caliente hoy"
@ -100,6 +100,11 @@ msgstr "{name} recibe {amount} daño."
msgid "{name} dies." msgid "{name} dies."
msgstr "{name} se muere." msgstr "{name} se muere."
#: squirrelbattle/interfaces.py:477
#, python-brace-format
msgid "{entity} said: {message}"
msgstr "{entity} dijo : {message}"
#: squirrelbattle/menus.py:73 #: squirrelbattle/menus.py:73
msgid "Back" msgid "Back"
msgstr "Volver" msgstr "Volver"
@ -199,33 +204,45 @@ msgid "player"
msgstr "jugador" msgstr "jugador"
#: squirrelbattle/tests/translations_test.py:61 #: squirrelbattle/tests/translations_test.py:61
msgid "tiger"
msgstr "tigre"
#: squirrelbattle/tests/translations_test.py:62
msgid "hedgehog" msgid "hedgehog"
msgstr "erizo" msgstr "erizo"
#: squirrelbattle/tests/translations_test.py:62
msgid "merchant"
msgstr "comerciante"
#: squirrelbattle/tests/translations_test.py:63 #: squirrelbattle/tests/translations_test.py:63
msgid "rabbit" msgid "rabbit"
msgstr "conejo" msgstr "conejo"
#: squirrelbattle/tests/translations_test.py:64 #: squirrelbattle/tests/translations_test.py:64
msgid "sunflower"
msgstr "girasol"
#: squirrelbattle/tests/translations_test.py:65
msgid "teddy bear" msgid "teddy bear"
msgstr "osito de peluche" msgstr "osito de peluche"
#: squirrelbattle/tests/translations_test.py:66 #: squirrelbattle/tests/translations_test.py:66
msgid "tiger"
msgstr "tigre"
#: squirrelbattle/tests/translations_test.py:68
msgid "body snatch potion" msgid "body snatch potion"
msgstr "poción de intercambio" msgstr "poción de intercambio"
#: squirrelbattle/tests/translations_test.py:67 #: squirrelbattle/tests/translations_test.py:69
msgid "bomb" msgid "bomb"
msgstr "bomba" msgstr "bomba"
#: squirrelbattle/tests/translations_test.py:68 #: squirrelbattle/tests/translations_test.py:70
msgid "explosion"
msgstr "explosión"
#: squirrelbattle/tests/translations_test.py:71
msgid "heart" msgid "heart"
msgstr "corazón" msgstr "corazón"
#: squirrelbattle/tests/translations_test.py:69 #: squirrelbattle/tests/translations_test.py:72
msgid "sword" msgid "sword"
msgstr "espada" msgstr "espada"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: squirrelbattle 3.14.1\n" "Project-Id-Version: squirrelbattle 3.14.1\n"
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n" "Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
"POT-Creation-Date: 2020-12-12 17:07+0100\n" "POT-Creation-Date: 2020-12-12 17:24+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -38,11 +38,11 @@ msgstr "VOUS ÊTES MORT"
msgid "I don't sell any squirrel" msgid "I don't sell any squirrel"
msgstr "Je ne vends pas d'écureuil" msgstr "Je ne vends pas d'écureuil"
#: squirrelbattle/entities/friendly.py:46 #: squirrelbattle/entities/friendly.py:52
msgid "Flower power!!" msgid "Flower power!!"
msgstr "Pouvoir des fleurs !" msgstr "Pouvoir des fleurs !!"
#: squirrelbattle/entities/friendly.py:46 #: squirrelbattle/entities/friendly.py:52
msgid "The sun is warm today" msgid "The sun is warm today"
msgstr "Le soleil est chaud aujourd'hui" msgstr "Le soleil est chaud aujourd'hui"
@ -101,6 +101,11 @@ msgstr "{name} prend {amount} points de dégât."
msgid "{name} dies." msgid "{name} dies."
msgstr "{name} meurt." msgstr "{name} meurt."
#: squirrelbattle/interfaces.py:477
#, python-brace-format
msgid "{entity} said: {message}"
msgstr "{entity} a dit : {message}"
#: squirrelbattle/menus.py:73 #: squirrelbattle/menus.py:73
msgid "Back" msgid "Back"
msgstr "Retour" msgstr "Retour"
@ -200,33 +205,45 @@ msgid "player"
msgstr "joueur" msgstr "joueur"
#: squirrelbattle/tests/translations_test.py:61 #: squirrelbattle/tests/translations_test.py:61
msgid "tiger"
msgstr "tigre"
#: squirrelbattle/tests/translations_test.py:62
msgid "hedgehog" msgid "hedgehog"
msgstr "hérisson" msgstr "hérisson"
#: squirrelbattle/tests/translations_test.py:62
msgid "merchant"
msgstr "marchand"
#: squirrelbattle/tests/translations_test.py:63 #: squirrelbattle/tests/translations_test.py:63
msgid "rabbit" msgid "rabbit"
msgstr "lapin" msgstr "lapin"
#: squirrelbattle/tests/translations_test.py:64 #: squirrelbattle/tests/translations_test.py:64
msgid "sunflower"
msgstr "tournesol"
#: squirrelbattle/tests/translations_test.py:65
msgid "teddy bear" msgid "teddy bear"
msgstr "nounours" msgstr "nounours"
#: squirrelbattle/tests/translations_test.py:66 #: squirrelbattle/tests/translations_test.py:66
msgid "tiger"
msgstr "tigre"
#: squirrelbattle/tests/translations_test.py:68
msgid "body snatch potion" msgid "body snatch potion"
msgstr "potion d'arrachage de corps" msgstr "potion d'arrachage de corps"
#: squirrelbattle/tests/translations_test.py:67 #: squirrelbattle/tests/translations_test.py:69
msgid "bomb" msgid "bomb"
msgstr "bombe" msgstr "bombe"
#: squirrelbattle/tests/translations_test.py:68 #: squirrelbattle/tests/translations_test.py:70
msgid "explosion"
msgstr ""
#: squirrelbattle/tests/translations_test.py:71
msgid "heart" msgid "heart"
msgstr "cœur" msgstr "cœur"
#: squirrelbattle/tests/translations_test.py:69 #: squirrelbattle/tests/translations_test.py:72
msgid "sword" msgid "sword"
msgstr "épée" msgstr "épée"

View File

@ -496,8 +496,8 @@ class TestGame(unittest.TestCase):
self.assertEqual(self.game.state, GameMode.PLAY) self.assertEqual(self.game.state, GameMode.PLAY)
self.assertTrue(self.game.logs.messages) self.assertTrue(self.game.logs.messages)
# Ensure that the message is a good message # Ensure that the message is a good message
self.assertIn(self.game.logs.messages[1][21:], self.assertIn(self.game.logs.messages[1][16:],
Sunflower.dialogue_option) Sunflower().dialogue_option)
# Test all directions to detect the friendly entity # Test all directions to detect the friendly entity
self.game.player.move(3, 6) self.game.player.move(3, 6)
@ -547,7 +547,7 @@ class TestGame(unittest.TestCase):
# Buy the second item by clicking on it # Buy the second item by clicking on it
item = self.game.store_menu.validate() item = self.game.store_menu.validate()
self.assertIn(item, merchant.inventory) self.assertIn(item, merchant.inventory)
self.game.display_actions(DisplayActions.MOUSE, 8, 25) self.game.display_actions(DisplayActions.MOUSE, 7, 25)
self.game.handle_key_pressed(KeyValues.ENTER) self.game.handle_key_pressed(KeyValues.ENTER)
self.assertIn(item, self.game.player.inventory) self.assertIn(item, self.game.player.inventory)
self.assertNotIn(item, merchant.inventory) self.assertNotIn(item, merchant.inventory)

View File

@ -58,12 +58,15 @@ class TestTranslations(unittest.TestCase):
def test_entities_translation(self) -> None: def test_entities_translation(self) -> None:
self.assertEqual(_("player"), "joueur") self.assertEqual(_("player"), "joueur")
self.assertEqual(_("tiger"), "tigre")
self.assertEqual(_("hedgehog"), "hérisson") self.assertEqual(_("hedgehog"), "hérisson")
self.assertEqual(_("merchant"), "marchand")
self.assertEqual(_("rabbit"), "lapin") self.assertEqual(_("rabbit"), "lapin")
self.assertEqual(_("sunflower"), "tournesol")
self.assertEqual(_("teddy bear"), "nounours") self.assertEqual(_("teddy bear"), "nounours")
self.assertEqual(_("tiger"), "tigre")
self.assertEqual(_("body snatch potion"), "potion d'arrachage de corps") self.assertEqual(_("body snatch potion"), "potion d'arrachage de corps")
self.assertEqual(_("bomb"), "bombe") self.assertEqual(_("bomb"), "bombe")
self.assertEqual(_("explosion"), "explosion")
self.assertEqual(_("heart"), "cœur") self.assertEqual(_("heart"), "cœur")
self.assertEqual(_("sword"), "épée") self.assertEqual(_("sword"), "épée")