Translate entities
This commit is contained in:
parent
8f85093eb8
commit
70ae60b9a4
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2020-11-27 22:20+0100\n"
|
"POT-Creation-Date: 2020-11-27 22:31+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"
|
||||||
|
@ -25,12 +25,12 @@ msgstr ""
|
||||||
msgid "YOU ARE DEAD"
|
msgid "YOU ARE DEAD"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/interfaces.py:394
|
#: squirrelbattle/interfaces.py:394 squirrelbattle/interfaces.py:398
|
||||||
#, python-brace-format
|
#, python-brace-format
|
||||||
msgid "{name} hits {opponent}."
|
msgid "{name} hits {opponent}."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/interfaces.py:405
|
#: squirrelbattle/interfaces.py:405 squirrelbattle/interfaces.py:410
|
||||||
#, python-brace-format
|
#, python-brace-format
|
||||||
msgid "{name} takes {amount} damage."
|
msgid "{name} takes {amount} damage."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -83,50 +83,89 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:21 squirrelbattle/tests/translations_test.py:21
|
#: squirrelbattle/settings.py:21 squirrelbattle/tests/translations_test.py:21
|
||||||
|
#: squirrelbattle/tests/translations_test.py:25
|
||||||
msgid "Main key to move up"
|
msgid "Main key to move up"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:22 squirrelbattle/tests/translations_test.py:23
|
#: squirrelbattle/settings.py:22 squirrelbattle/tests/translations_test.py:23
|
||||||
|
#: squirrelbattle/tests/translations_test.py:27
|
||||||
msgid "Secondary key to move up"
|
msgid "Secondary key to move up"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:23 squirrelbattle/tests/translations_test.py:25
|
#: squirrelbattle/settings.py:23 squirrelbattle/tests/translations_test.py:25
|
||||||
|
#: squirrelbattle/tests/translations_test.py:29
|
||||||
msgid "Main key to move down"
|
msgid "Main key to move down"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:24 squirrelbattle/tests/translations_test.py:27
|
#: squirrelbattle/settings.py:24 squirrelbattle/tests/translations_test.py:27
|
||||||
|
#: squirrelbattle/tests/translations_test.py:31
|
||||||
msgid "Secondary key to move down"
|
msgid "Secondary key to move down"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:25 squirrelbattle/tests/translations_test.py:29
|
#: squirrelbattle/settings.py:25 squirrelbattle/tests/translations_test.py:29
|
||||||
|
#: squirrelbattle/tests/translations_test.py:33
|
||||||
msgid "Main key to move left"
|
msgid "Main key to move left"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:26 squirrelbattle/tests/translations_test.py:31
|
#: squirrelbattle/settings.py:26 squirrelbattle/tests/translations_test.py:31
|
||||||
|
#: squirrelbattle/tests/translations_test.py:35
|
||||||
msgid "Secondary key to move left"
|
msgid "Secondary key to move left"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:27 squirrelbattle/tests/translations_test.py:33
|
#: squirrelbattle/settings.py:27 squirrelbattle/tests/translations_test.py:33
|
||||||
|
#: squirrelbattle/tests/translations_test.py:37
|
||||||
msgid "Main key to move right"
|
msgid "Main key to move right"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:29 squirrelbattle/tests/translations_test.py:35
|
#: squirrelbattle/settings.py:29 squirrelbattle/tests/translations_test.py:35
|
||||||
|
#: squirrelbattle/tests/translations_test.py:39
|
||||||
msgid "Secondary key to move right"
|
msgid "Secondary key to move right"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:30 squirrelbattle/tests/translations_test.py:37
|
#: squirrelbattle/settings.py:30 squirrelbattle/tests/translations_test.py:37
|
||||||
|
#: squirrelbattle/tests/translations_test.py:41
|
||||||
msgid "Key to validate a menu"
|
msgid "Key to validate a menu"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:31 squirrelbattle/tests/translations_test.py:39
|
#: squirrelbattle/settings.py:31 squirrelbattle/tests/translations_test.py:39
|
||||||
|
#: squirrelbattle/tests/translations_test.py:43
|
||||||
msgid "Texture pack"
|
msgid "Texture pack"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:32 squirrelbattle/tests/translations_test.py:40
|
#: squirrelbattle/settings.py:32 squirrelbattle/tests/translations_test.py:40
|
||||||
|
#: squirrelbattle/tests/translations_test.py:44
|
||||||
msgid "Language"
|
msgid "Language"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/interfaces.py:407
|
#: squirrelbattle/interfaces.py:407 squirrelbattle/interfaces.py:412
|
||||||
#, python-brace-format
|
#, python-brace-format
|
||||||
msgid "{name} dies."
|
msgid "{name} dies."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:47
|
||||||
|
msgid "player"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:49
|
||||||
|
msgid "tiger"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:50
|
||||||
|
msgid "hedgehog"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:51
|
||||||
|
msgid "rabbit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:52
|
||||||
|
msgid "teddy bear"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:54
|
||||||
|
msgid "bomb"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:55
|
||||||
|
msgid "heart"
|
||||||
|
msgstr ""
|
||||||
|
|
Binary file not shown.
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2020-11-27 22:20+0100\n"
|
"POT-Creation-Date: 2020-11-27 22:31+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"
|
||||||
|
@ -25,12 +25,12 @@ msgstr "Inventaire :"
|
||||||
msgid "YOU ARE DEAD"
|
msgid "YOU ARE DEAD"
|
||||||
msgstr "VOUS ÊTES MORT"
|
msgstr "VOUS ÊTES MORT"
|
||||||
|
|
||||||
#: squirrelbattle/interfaces.py:394
|
#: squirrelbattle/interfaces.py:394 squirrelbattle/interfaces.py:398
|
||||||
#, python-brace-format
|
#, python-brace-format
|
||||||
msgid "{name} hits {opponent}."
|
msgid "{name} hits {opponent}."
|
||||||
msgstr "{name} frappe {opponent}."
|
msgstr "{name} frappe {opponent}."
|
||||||
|
|
||||||
#: squirrelbattle/interfaces.py:405
|
#: squirrelbattle/interfaces.py:405 squirrelbattle/interfaces.py:410
|
||||||
#, python-brace-format
|
#, python-brace-format
|
||||||
msgid "{name} takes {amount} damage."
|
msgid "{name} takes {amount} damage."
|
||||||
msgstr "{name} prend {amount} points de dégât."
|
msgstr "{name} prend {amount} points de dégât."
|
||||||
|
@ -89,50 +89,89 @@ msgstr ""
|
||||||
"Votre sauvegarde semble corrompue. Elle a été supprimée."
|
"Votre sauvegarde semble corrompue. Elle a été supprimée."
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:21 squirrelbattle/tests/translations_test.py:21
|
#: squirrelbattle/settings.py:21 squirrelbattle/tests/translations_test.py:21
|
||||||
|
#: squirrelbattle/tests/translations_test.py:25
|
||||||
msgid "Main key to move up"
|
msgid "Main key to move up"
|
||||||
msgstr "Touche principale pour aller vers le haut"
|
msgstr "Touche principale pour aller vers le haut"
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:22 squirrelbattle/tests/translations_test.py:23
|
#: squirrelbattle/settings.py:22 squirrelbattle/tests/translations_test.py:23
|
||||||
|
#: squirrelbattle/tests/translations_test.py:27
|
||||||
msgid "Secondary key to move up"
|
msgid "Secondary key to move up"
|
||||||
msgstr "Touche secondaire pour aller vers le haut"
|
msgstr "Touche secondaire pour aller vers le haut"
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:23 squirrelbattle/tests/translations_test.py:25
|
#: squirrelbattle/settings.py:23 squirrelbattle/tests/translations_test.py:25
|
||||||
|
#: squirrelbattle/tests/translations_test.py:29
|
||||||
msgid "Main key to move down"
|
msgid "Main key to move down"
|
||||||
msgstr "Touche principale pour aller vers le bas"
|
msgstr "Touche principale pour aller vers le bas"
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:24 squirrelbattle/tests/translations_test.py:27
|
#: squirrelbattle/settings.py:24 squirrelbattle/tests/translations_test.py:27
|
||||||
|
#: squirrelbattle/tests/translations_test.py:31
|
||||||
msgid "Secondary key to move down"
|
msgid "Secondary key to move down"
|
||||||
msgstr "Touche secondaire pour aller vers le bas"
|
msgstr "Touche secondaire pour aller vers le bas"
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:25 squirrelbattle/tests/translations_test.py:29
|
#: squirrelbattle/settings.py:25 squirrelbattle/tests/translations_test.py:29
|
||||||
|
#: squirrelbattle/tests/translations_test.py:33
|
||||||
msgid "Main key to move left"
|
msgid "Main key to move left"
|
||||||
msgstr "Touche principale pour aller vers la gauche"
|
msgstr "Touche principale pour aller vers la gauche"
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:26 squirrelbattle/tests/translations_test.py:31
|
#: squirrelbattle/settings.py:26 squirrelbattle/tests/translations_test.py:31
|
||||||
|
#: squirrelbattle/tests/translations_test.py:35
|
||||||
msgid "Secondary key to move left"
|
msgid "Secondary key to move left"
|
||||||
msgstr "Touche secondaire pour aller vers la gauche"
|
msgstr "Touche secondaire pour aller vers la gauche"
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:27 squirrelbattle/tests/translations_test.py:33
|
#: squirrelbattle/settings.py:27 squirrelbattle/tests/translations_test.py:33
|
||||||
|
#: squirrelbattle/tests/translations_test.py:37
|
||||||
msgid "Main key to move right"
|
msgid "Main key to move right"
|
||||||
msgstr "Touche principale pour aller vers la droite"
|
msgstr "Touche principale pour aller vers la droite"
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:29 squirrelbattle/tests/translations_test.py:35
|
#: squirrelbattle/settings.py:29 squirrelbattle/tests/translations_test.py:35
|
||||||
|
#: squirrelbattle/tests/translations_test.py:39
|
||||||
msgid "Secondary key to move right"
|
msgid "Secondary key to move right"
|
||||||
msgstr "Touche secondaire pour aller vers la droite"
|
msgstr "Touche secondaire pour aller vers la droite"
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:30 squirrelbattle/tests/translations_test.py:37
|
#: squirrelbattle/settings.py:30 squirrelbattle/tests/translations_test.py:37
|
||||||
|
#: squirrelbattle/tests/translations_test.py:41
|
||||||
msgid "Key to validate a menu"
|
msgid "Key to validate a menu"
|
||||||
msgstr "Touche pour valider un menu"
|
msgstr "Touche pour valider un menu"
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:31 squirrelbattle/tests/translations_test.py:39
|
#: squirrelbattle/settings.py:31 squirrelbattle/tests/translations_test.py:39
|
||||||
|
#: squirrelbattle/tests/translations_test.py:43
|
||||||
msgid "Texture pack"
|
msgid "Texture pack"
|
||||||
msgstr "Pack de textures"
|
msgstr "Pack de textures"
|
||||||
|
|
||||||
#: squirrelbattle/settings.py:32 squirrelbattle/tests/translations_test.py:40
|
#: squirrelbattle/settings.py:32 squirrelbattle/tests/translations_test.py:40
|
||||||
|
#: squirrelbattle/tests/translations_test.py:44
|
||||||
msgid "Language"
|
msgid "Language"
|
||||||
msgstr "Langue"
|
msgstr "Langue"
|
||||||
|
|
||||||
#: squirrelbattle/interfaces.py:407
|
#: squirrelbattle/interfaces.py:407 squirrelbattle/interfaces.py:412
|
||||||
#, python-brace-format
|
#, python-brace-format
|
||||||
msgid "{name} dies."
|
msgid "{name} dies."
|
||||||
msgstr "{name} meurt."
|
msgstr "{name} meurt."
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:47
|
||||||
|
msgid "player"
|
||||||
|
msgstr "joueur"
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:49
|
||||||
|
msgid "tiger"
|
||||||
|
msgstr "tigre"
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:50
|
||||||
|
msgid "hedgehog"
|
||||||
|
msgstr "hérisson"
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:51
|
||||||
|
msgid "rabbit"
|
||||||
|
msgstr "lapin"
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:52
|
||||||
|
msgid "teddy bear"
|
||||||
|
msgstr "nounours"
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:54
|
||||||
|
msgid "bomb"
|
||||||
|
msgstr "bombe"
|
||||||
|
|
||||||
|
#: squirrelbattle/tests/translations_test.py:55
|
||||||
|
msgid "heart"
|
||||||
|
msgstr "cœur"
|
||||||
|
|
|
@ -315,6 +315,10 @@ class Entity:
|
||||||
from squirrelbattle.entities.items import Item
|
from squirrelbattle.entities.items import Item
|
||||||
return isinstance(self, Item)
|
return isinstance(self, Item)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def translated_name(self) -> str:
|
||||||
|
return _(self.name.replace("_", " "))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_all_entity_classes():
|
def get_all_entity_classes():
|
||||||
"""
|
"""
|
||||||
|
@ -392,8 +396,9 @@ class FightingEntity(Entity):
|
||||||
Deals damage to the opponent, based on the stats
|
Deals damage to the opponent, based on the stats
|
||||||
"""
|
"""
|
||||||
return _("{name} hits {opponent}.")\
|
return _("{name} hits {opponent}.")\
|
||||||
.format(name=self.name, opponent=opponent.name) + " "\
|
.format(name=_(self.translated_name.capitalize()),
|
||||||
+ opponent.take_damage(self, self.strength)
|
opponent=_(opponent.translated_name)) + " " + \
|
||||||
|
opponent.take_damage(self, self.strength)
|
||||||
|
|
||||||
def take_damage(self, attacker: "Entity", amount: int) -> str:
|
def take_damage(self, attacker: "Entity", amount: int) -> str:
|
||||||
"""
|
"""
|
||||||
|
@ -403,8 +408,9 @@ class FightingEntity(Entity):
|
||||||
if self.health <= 0:
|
if self.health <= 0:
|
||||||
self.die()
|
self.die()
|
||||||
return _("{name} takes {amount} damage.")\
|
return _("{name} takes {amount} damage.")\
|
||||||
.format(name=self.name, amount=str(amount)) \
|
.format(name=self.translated_name.capitalize(), amount=str(amount))\
|
||||||
+ (" " + _("{name} dies.").format(name=self.name)
|
+ (" " + _("{name} dies.")
|
||||||
|
.format(name=self.translated_name.capitalize())
|
||||||
if self.health <= 0 else "")
|
if self.health <= 0 else "")
|
||||||
|
|
||||||
def die(self) -> None:
|
def die(self) -> None:
|
||||||
|
|
|
@ -7,9 +7,9 @@ class TestTranslations(unittest.TestCase):
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
setlocale("fr")
|
setlocale("fr")
|
||||||
|
|
||||||
def test_translations(self) -> None:
|
def test_main_menu_translation(self) -> None:
|
||||||
"""
|
"""
|
||||||
Ensure that some strings are well-translated.
|
Ensure that the main menu is translated.
|
||||||
"""
|
"""
|
||||||
self.assertEqual(_("New game"), "Nouvelle partie")
|
self.assertEqual(_("New game"), "Nouvelle partie")
|
||||||
self.assertEqual(_("Resume"), "Continuer")
|
self.assertEqual(_("Resume"), "Continuer")
|
||||||
|
@ -18,6 +18,10 @@ class TestTranslations(unittest.TestCase):
|
||||||
self.assertEqual(_("Settings"), "Paramètres")
|
self.assertEqual(_("Settings"), "Paramètres")
|
||||||
self.assertEqual(_("Exit"), "Quitter")
|
self.assertEqual(_("Exit"), "Quitter")
|
||||||
|
|
||||||
|
def test_settings_menu_translation(self) -> None:
|
||||||
|
"""
|
||||||
|
Ensure that the settings menu is translated.
|
||||||
|
"""
|
||||||
self.assertEqual(_("Main key to move up"),
|
self.assertEqual(_("Main key to move up"),
|
||||||
"Touche principale pour aller vers le haut")
|
"Touche principale pour aller vers le haut")
|
||||||
self.assertEqual(_("Secondary key to move up"),
|
self.assertEqual(_("Secondary key to move up"),
|
||||||
|
@ -38,3 +42,14 @@ class TestTranslations(unittest.TestCase):
|
||||||
"Touche pour valider un menu")
|
"Touche pour valider un menu")
|
||||||
self.assertEqual(_("Texture pack"), "Pack de textures")
|
self.assertEqual(_("Texture pack"), "Pack de textures")
|
||||||
self.assertEqual(_("Language"), "Langue")
|
self.assertEqual(_("Language"), "Langue")
|
||||||
|
|
||||||
|
def test_entities_translation(self) -> None:
|
||||||
|
self.assertEqual(_("player"), "joueur")
|
||||||
|
|
||||||
|
self.assertEqual(_("tiger"), "tigre")
|
||||||
|
self.assertEqual(_("hedgehog"), "hérisson")
|
||||||
|
self.assertEqual(_("rabbit"), "lapin")
|
||||||
|
self.assertEqual(_("teddy bear"), "nounours")
|
||||||
|
|
||||||
|
self.assertEqual(_("bomb"), "bombe")
|
||||||
|
self.assertEqual(_("heart"), "cœur")
|
||||||
|
|
Loading…
Reference in New Issue