Settings menu was not translated
This commit is contained in:
parent
f07324662a
commit
d2d74c97a4
|
@ -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 21:43+0100\n"
|
"POT-Creation-Date: 2020-11-27 22:05+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"
|
||||||
|
@ -36,6 +36,7 @@ msgid "{name} takes {amount} damage."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: squirrelbattle/menus.py:45 squirrelbattle/tests/translations_test.py:14
|
#: squirrelbattle/menus.py:45 squirrelbattle/tests/translations_test.py:14
|
||||||
|
#: squirrelbattle/tests/game_test.py:284 squirrelbattle/tests/game_test.py:287
|
||||||
msgid "New game"
|
msgid "New game"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -80,3 +81,47 @@ msgid ""
|
||||||
"The JSON file is not correct.\n"
|
"The JSON file is not correct.\n"
|
||||||
"Your save seems corrupted.It got deleted."
|
"Your save seems corrupted.It got deleted."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:21 squirrelbattle/tests/translations_test.py:21
|
||||||
|
msgid "Main key to move up"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:22 squirrelbattle/tests/translations_test.py:23
|
||||||
|
msgid "Secondary key to move up"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:23 squirrelbattle/tests/translations_test.py:25
|
||||||
|
msgid "Main key to move down"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:24 squirrelbattle/tests/translations_test.py:27
|
||||||
|
msgid "Secondary key to move down"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:25 squirrelbattle/tests/translations_test.py:29
|
||||||
|
msgid "Main key to move left"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:26 squirrelbattle/tests/translations_test.py:31
|
||||||
|
msgid "Secondary key to move left"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:27 squirrelbattle/tests/translations_test.py:33
|
||||||
|
msgid "Main key to move right"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:29 squirrelbattle/tests/translations_test.py:35
|
||||||
|
msgid "Secondary key to move right"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:30 squirrelbattle/tests/translations_test.py:37
|
||||||
|
msgid "Key to validate a menu"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:31 squirrelbattle/tests/translations_test.py:39
|
||||||
|
msgid "Texture pack"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:32 squirrelbattle/tests/translations_test.py:40
|
||||||
|
msgid "Language"
|
||||||
|
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 21:43+0100\n"
|
"POT-Creation-Date: 2020-11-27 22:05+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"
|
||||||
|
@ -36,6 +36,7 @@ msgid "{name} takes {amount} damage."
|
||||||
msgstr "{name} prend {amount} points de dégât."
|
msgstr "{name} prend {amount} points de dégât."
|
||||||
|
|
||||||
#: squirrelbattle/menus.py:45 squirrelbattle/tests/translations_test.py:14
|
#: squirrelbattle/menus.py:45 squirrelbattle/tests/translations_test.py:14
|
||||||
|
#: squirrelbattle/tests/game_test.py:284 squirrelbattle/tests/game_test.py:287
|
||||||
msgid "New game"
|
msgid "New game"
|
||||||
msgstr "Nouvelle partie"
|
msgstr "Nouvelle partie"
|
||||||
|
|
||||||
|
@ -86,3 +87,47 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Le fichier JSON de sauvegarde est incorrect.\n"
|
"Le fichier JSON de sauvegarde est incorrect.\n"
|
||||||
"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
|
||||||
|
msgid "Main key to move up"
|
||||||
|
msgstr "Touche principale pour aller vers le haut"
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:22 squirrelbattle/tests/translations_test.py:23
|
||||||
|
msgid "Secondary key to move up"
|
||||||
|
msgstr "Touche secondaire pour aller vers le haut"
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:23 squirrelbattle/tests/translations_test.py:25
|
||||||
|
msgid "Main key to move down"
|
||||||
|
msgstr "Touche principale pour aller vers le bas"
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:24 squirrelbattle/tests/translations_test.py:27
|
||||||
|
msgid "Secondary key to move down"
|
||||||
|
msgstr "Touche secondaire pour aller vers le bas"
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:25 squirrelbattle/tests/translations_test.py:29
|
||||||
|
msgid "Main key to move left"
|
||||||
|
msgstr "Touche principale pour aller vers la gauche"
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:26 squirrelbattle/tests/translations_test.py:31
|
||||||
|
msgid "Secondary key to move left"
|
||||||
|
msgstr "Touche secondaire pour aller vers la gauche"
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:27 squirrelbattle/tests/translations_test.py:33
|
||||||
|
msgid "Main key to move right"
|
||||||
|
msgstr "Touche principale pour aller vers la droite"
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:29 squirrelbattle/tests/translations_test.py:35
|
||||||
|
msgid "Secondary key to move right"
|
||||||
|
msgstr "Touche secondaire pour aller vers la droite"
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:30 squirrelbattle/tests/translations_test.py:37
|
||||||
|
msgid "Key to validate a menu"
|
||||||
|
msgstr "Touche pour valider un menu"
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:31 squirrelbattle/tests/translations_test.py:39
|
||||||
|
msgid "Texture pack"
|
||||||
|
msgstr "Pack de textures"
|
||||||
|
|
||||||
|
#: squirrelbattle/settings.py:32 squirrelbattle/tests/translations_test.py:40
|
||||||
|
msgid "Language"
|
||||||
|
msgstr "Langue"
|
||||||
|
|
|
@ -6,6 +6,7 @@ from typing import List
|
||||||
from squirrelbattle.menus import Menu, MainMenu
|
from squirrelbattle.menus import Menu, MainMenu
|
||||||
from .display import Display, Box
|
from .display import Display, Box
|
||||||
from ..resources import ResourceManager
|
from ..resources import ResourceManager
|
||||||
|
from ..translations import gettext as _
|
||||||
|
|
||||||
|
|
||||||
class MenuDisplay(Display):
|
class MenuDisplay(Display):
|
||||||
|
@ -66,9 +67,10 @@ class MenuDisplay(Display):
|
||||||
class SettingsMenuDisplay(MenuDisplay):
|
class SettingsMenuDisplay(MenuDisplay):
|
||||||
@property
|
@property
|
||||||
def values(self) -> List[str]:
|
def values(self) -> List[str]:
|
||||||
return [a[1][1] + (" : "
|
return [_(a[1][1]) + (" : "
|
||||||
+ ("?" if self.menu.waiting_for_key
|
+ ("?" if self.menu.waiting_for_key
|
||||||
and a == self.menu.validate() else a[1][0])
|
and a == self.menu.validate() else a[1][0]
|
||||||
|
.replace("\n", "\\n"))
|
||||||
if a[1][0] else "") for a in self.menu.values]
|
if a[1][0] else "") for a in self.menu.values]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,12 @@ class Game:
|
||||||
Init the game.
|
Init the game.
|
||||||
"""
|
"""
|
||||||
self.state = GameMode.MAINMENU
|
self.state = GameMode.MAINMENU
|
||||||
self.main_menu = menus.MainMenu()
|
|
||||||
self.settings_menu = menus.SettingsMenu()
|
|
||||||
self.settings = Settings()
|
self.settings = Settings()
|
||||||
self.settings.load_settings()
|
self.settings.load_settings()
|
||||||
self.settings.write_settings()
|
self.settings.write_settings()
|
||||||
setlocale(self.settings.LOCALE)
|
setlocale(self.settings.LOCALE)
|
||||||
|
self.main_menu = menus.MainMenu()
|
||||||
|
self.settings_menu = menus.SettingsMenu()
|
||||||
self.settings_menu.update_values(self.settings)
|
self.settings_menu.update_values(self.settings)
|
||||||
self.logs = Logs()
|
self.logs = Logs()
|
||||||
self.message = None
|
self.message = None
|
||||||
|
|
|
@ -7,6 +7,7 @@ import os
|
||||||
from typing import Any, Generator
|
from typing import Any, Generator
|
||||||
|
|
||||||
from .resources import ResourceManager
|
from .resources import ResourceManager
|
||||||
|
from .translations import gettext as _
|
||||||
|
|
||||||
|
|
||||||
class Settings:
|
class Settings:
|
||||||
|
@ -17,26 +18,17 @@ class Settings:
|
||||||
We can define the setting by simply use settings.TEXTURE_PACK = 'new_key'
|
We can define the setting by simply use settings.TEXTURE_PACK = 'new_key'
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.KEY_UP_PRIMARY = \
|
self.KEY_UP_PRIMARY = ['z', 'Main key to move up']
|
||||||
['z', 'Touche principale pour aller vers le haut']
|
self.KEY_UP_SECONDARY = ['KEY_UP', 'Secondary key to move up']
|
||||||
self.KEY_UP_SECONDARY = \
|
self.KEY_DOWN_PRIMARY = ['s', 'Main key to move down']
|
||||||
['KEY_UP', 'Touche secondaire pour aller vers le haut']
|
self.KEY_DOWN_SECONDARY = ['KEY_DOWN', 'Secondary key to move down']
|
||||||
self.KEY_DOWN_PRIMARY = \
|
self.KEY_LEFT_PRIMARY = ['q', 'Main key to move left']
|
||||||
['s', 'Touche principale pour aller vers le bas']
|
self.KEY_LEFT_SECONDARY = ['KEY_LEFT', 'Secondary key to move left']
|
||||||
self.KEY_DOWN_SECONDARY = \
|
self.KEY_RIGHT_PRIMARY = ['d', 'Main key to move right']
|
||||||
['KEY_DOWN', 'Touche secondaire pour aller vers le bas']
|
self.KEY_RIGHT_SECONDARY = ['KEY_RIGHT', 'Secondary key to move right']
|
||||||
self.KEY_LEFT_PRIMARY = \
|
self.KEY_ENTER = ['\n', 'Key to validate a menu']
|
||||||
['q', 'Touche principale pour aller vers la gauche']
|
self.TEXTURE_PACK = ['ascii', 'Texture pack']
|
||||||
self.KEY_LEFT_SECONDARY = \
|
self.LOCALE = [locale.getlocale()[0][:2], 'Language']
|
||||||
['KEY_LEFT', 'Touche secondaire pour aller vers la gauche']
|
|
||||||
self.KEY_RIGHT_PRIMARY = \
|
|
||||||
['d', 'Touche principale pour aller vers la droite']
|
|
||||||
self.KEY_RIGHT_SECONDARY = \
|
|
||||||
['KEY_RIGHT', 'Touche secondaire pour aller vers la droite']
|
|
||||||
self.KEY_ENTER = \
|
|
||||||
['\n', 'Touche pour valider un menu']
|
|
||||||
self.TEXTURE_PACK = ['ascii', 'Pack de textures utilisé']
|
|
||||||
self.LOCALE = [locale.getlocale()[0][:2], 'Langue']
|
|
||||||
|
|
||||||
def __getattribute__(self, item: str) -> Any:
|
def __getattribute__(self, item: str) -> Any:
|
||||||
superattribute = super().__getattribute__(item)
|
superattribute = super().__getattribute__(item)
|
||||||
|
@ -55,10 +47,10 @@ class Settings:
|
||||||
Retrieve the comment of a setting.
|
Retrieve the comment of a setting.
|
||||||
"""
|
"""
|
||||||
if item in self.settings_keys:
|
if item in self.settings_keys:
|
||||||
return object.__getattribute__(self, item)[1]
|
return _(object.__getattribute__(self, item)[1])
|
||||||
for key in self.settings_keys:
|
for key in self.settings_keys:
|
||||||
if getattr(self, key) == item:
|
if getattr(self, key) == item:
|
||||||
return object.__getattribute__(self, key)[1]
|
return _(object.__getattribute__(self, key)[1])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def settings_keys(self) -> Generator[str, Any, None]:
|
def settings_keys(self) -> Generator[str, Any, None]:
|
||||||
|
|
|
@ -24,7 +24,7 @@ class TestSettings(unittest.TestCase):
|
||||||
self.assertEqual(settings.get_comment(settings.TEXTURE_PACK),
|
self.assertEqual(settings.get_comment(settings.TEXTURE_PACK),
|
||||||
settings.get_comment('TEXTURE_PACK'))
|
settings.get_comment('TEXTURE_PACK'))
|
||||||
self.assertEqual(settings.get_comment(settings.TEXTURE_PACK),
|
self.assertEqual(settings.get_comment(settings.TEXTURE_PACK),
|
||||||
'Pack de textures utilisé')
|
'Texture pack')
|
||||||
|
|
||||||
settings.TEXTURE_PACK = 'squirrel'
|
settings.TEXTURE_PACK = 'squirrel'
|
||||||
self.assertEqual(settings.TEXTURE_PACK, 'squirrel')
|
self.assertEqual(settings.TEXTURE_PACK, 'squirrel')
|
||||||
|
|
|
@ -17,3 +17,24 @@ class TestTranslations(unittest.TestCase):
|
||||||
self.assertEqual(_("Save"), "Sauvegarder")
|
self.assertEqual(_("Save"), "Sauvegarder")
|
||||||
self.assertEqual(_("Settings"), "Paramètres")
|
self.assertEqual(_("Settings"), "Paramètres")
|
||||||
self.assertEqual(_("Exit"), "Quitter")
|
self.assertEqual(_("Exit"), "Quitter")
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
Loading…
Reference in New Issue