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-11-27 21:33:58 +00:00
|
|
|
Ensure 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:
|
|
|
|
"""
|
|
|
|
Ensure that the settings menu is translated.
|
|
|
|
"""
|
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-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(_("tiger"), "tigre")
|
|
|
|
self.assertEqual(_("hedgehog"), "hérisson")
|
|
|
|
self.assertEqual(_("rabbit"), "lapin")
|
|
|
|
self.assertEqual(_("teddy bear"), "nounours")
|
|
|
|
|
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")
|
|
|
|
self.assertEqual(_("heart"), "cœur")
|
2020-12-11 17:08:10 +00:00
|
|
|
self.assertEqual(_("sword"), "épée")
|