squirrel-battle/squirrelbattle/tests/translations_test.py

56 lines
2.3 KiB
Python
Raw Normal View History

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 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")
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")
self.assertEqual(_("bomb"), "bombe")
self.assertEqual(_("heart"), "cœur")