2020-11-27 20:44:17 +00:00
|
|
|
import unittest
|
|
|
|
|
2020-11-28 00:59:52 +00:00
|
|
|
from squirrelbattle.translations import gettext as _, Translator
|
2020-11-27 20:44:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestTranslations(unittest.TestCase):
|
|
|
|
def setUp(self) -> None:
|
2020-11-28 13:02:23 +00:00
|
|
|
Translator.compilemessages()
|
|
|
|
Translator.refresh_translations()
|
2020-11-28 00:59:52 +00:00
|
|
|
Translator.setlocale("fr")
|
2020-11-27 20:44:17 +00:00
|
|
|
|
2020-11-27 21:33:58 +00:00
|
|
|
def test_main_menu_translation(self) -> None:
|
2020-11-27 20:44:17 +00:00
|
|
|
"""
|
2020-12-13 20:29:25 +00:00
|
|
|
Ensures that the main menu is translated.
|
2020-11-27 20:44:17 +00:00
|
|
|
"""
|
|
|
|
self.assertEqual(_("New game"), "Nouvelle partie")
|
|
|
|
self.assertEqual(_("Resume"), "Continuer")
|
|
|
|
self.assertEqual(_("Load"), "Charger")
|
|
|
|
self.assertEqual(_("Save"), "Sauvegarder")
|
|
|
|
self.assertEqual(_("Settings"), "Paramètres")
|
|
|
|
self.assertEqual(_("Exit"), "Quitter")
|
2020-11-27 21:19:41 +00:00
|
|
|
|
2020-11-27 21:33:58 +00:00
|
|
|
def test_settings_menu_translation(self) -> None:
|
|
|
|
"""
|
2020-12-13 20:29:25 +00:00
|
|
|
Ensures that the settings menu is translated.
|
2020-11-27 21:33:58 +00:00
|
|
|
"""
|
2020-11-27 21:19:41 +00:00
|
|
|
self.assertEqual(_("Main key to move up"),
|
|
|
|
"Touche principale pour aller vers le haut")
|
|
|
|
self.assertEqual(_("Secondary key to move up"),
|
|
|
|
"Touche secondaire pour aller vers le haut")
|
|
|
|
self.assertEqual(_("Main key to move down"),
|
|
|
|
"Touche principale pour aller vers le bas")
|
|
|
|
self.assertEqual(_("Secondary key to move down"),
|
|
|
|
"Touche secondaire pour aller vers le bas")
|
|
|
|
self.assertEqual(_("Main key to move left"),
|
|
|
|
"Touche principale pour aller vers la gauche")
|
|
|
|
self.assertEqual(_("Secondary key to move left"),
|
|
|
|
"Touche secondaire pour aller vers la gauche")
|
|
|
|
self.assertEqual(_("Main key to move right"),
|
|
|
|
"Touche principale pour aller vers la droite")
|
|
|
|
self.assertEqual(_("Secondary key to move right"),
|
|
|
|
"Touche secondaire pour aller vers la droite")
|
|
|
|
self.assertEqual(_("Key to validate a menu"),
|
|
|
|
"Touche pour valider un menu")
|
2020-12-06 10:43:48 +00:00
|
|
|
self.assertEqual(_("Key used to open the inventory"),
|
|
|
|
"Touche utilisée pour ouvrir l'inventaire")
|
|
|
|
self.assertEqual(_("Key used to use an item in the inventory"),
|
|
|
|
"Touche pour utiliser un objet de l'inventaire")
|
|
|
|
self.assertEqual(_("Key used to equip an item in the inventory"),
|
|
|
|
"Touche pour équiper un objet de l'inventaire")
|
|
|
|
self.assertEqual(_("Key used to drop an item in the inventory"),
|
|
|
|
"Touche pour jeter un objet de l'inventaire")
|
2020-12-09 14:45:50 +00:00
|
|
|
self.assertEqual(_("Key used to talk to a friendly entity"),
|
|
|
|
"Touche pour parler à une entité pacifique")
|
2020-12-12 17:12:37 +00:00
|
|
|
self.assertEqual(_("Key used to wait"), "Touche pour attendre")
|
2021-01-06 13:55:16 +00:00
|
|
|
self.assertEqual(_("Key used to use ladders"),
|
|
|
|
"Touche pour utiliser les échelles")
|
2020-11-27 21:19:41 +00:00
|
|
|
self.assertEqual(_("Texture pack"), "Pack de textures")
|
|
|
|
self.assertEqual(_("Language"), "Langue")
|
2020-11-27 21:33:58 +00:00
|
|
|
|
|
|
|
def test_entities_translation(self) -> None:
|
|
|
|
self.assertEqual(_("player"), "joueur")
|
|
|
|
|
|
|
|
self.assertEqual(_("hedgehog"), "hérisson")
|
2020-12-12 16:39:12 +00:00
|
|
|
self.assertEqual(_("merchant"), "marchand")
|
2020-11-27 21:33:58 +00:00
|
|
|
self.assertEqual(_("rabbit"), "lapin")
|
2020-12-12 16:39:12 +00:00
|
|
|
self.assertEqual(_("sunflower"), "tournesol")
|
2020-11-27 21:33:58 +00:00
|
|
|
self.assertEqual(_("teddy bear"), "nounours")
|
2020-12-12 16:39:12 +00:00
|
|
|
self.assertEqual(_("tiger"), "tigre")
|
2021-01-08 13:51:56 +00:00
|
|
|
self.assertEqual(_("eagle"), "pygargue")
|
2020-11-27 21:33:58 +00:00
|
|
|
|
2020-12-06 10:43:48 +00:00
|
|
|
self.assertEqual(_("body snatch potion"), "potion d'arrachage de corps")
|
2020-11-27 21:33:58 +00:00
|
|
|
self.assertEqual(_("bomb"), "bombe")
|
2020-12-12 16:39:12 +00:00
|
|
|
self.assertEqual(_("explosion"), "explosion")
|
2020-11-27 21:33:58 +00:00
|
|
|
self.assertEqual(_("heart"), "cœur")
|
2020-12-11 17:08:10 +00:00
|
|
|
self.assertEqual(_("sword"), "épée")
|
2021-01-08 11:06:28 +00:00
|
|
|
self.assertEqual(_("helmet"), "casque")
|
|
|
|
self.assertEqual(_("chestplate"), "plastron")
|
|
|
|
self.assertEqual(_("shield"), "bouclier")
|
|
|
|
self.assertEqual(_("ring of critical damage"),
|
|
|
|
"anneau de coup critique")
|
|
|
|
self.assertEqual(_("ring of more experience"),
|
|
|
|
"anneau de plus d'expérience")
|
2021-01-08 14:48:12 +00:00
|
|
|
self.assertEqual(_("monocle"), "monocle")
|