From 9f0a29302dd84691938642dd030a65a4db6eebd6 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 28 Nov 2020 16:22:06 +0100 Subject: [PATCH] Add german translation --- docs/deployment.rst | 2 +- docs/translation.rst | 2 +- setup.py | 2 +- .../locale/de/LC_MESSAGES/squirrelbattle.po | 166 ++++++++++++++++++ .../locale/en/LC_MESSAGES/squirrelbattle.po | 26 ++- .../locale/fr/LC_MESSAGES/squirrelbattle.po | 26 ++- squirrelbattle/menus.py | 2 +- squirrelbattle/tests/game_test.py | 3 + squirrelbattle/translations.py | 2 +- 9 files changed, 224 insertions(+), 7 deletions(-) create mode 100644 squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po diff --git a/docs/deployment.rst b/docs/deployment.rst index 6a57b58..9477a10 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -35,7 +35,7 @@ paquet ainsi que des détails à fournir à PyPI : long_description = f.read() # Compile messages - for language in ["en", "fr"]: + for language in ["de", "en", "fr"]: args = ["msgfmt", "--check-format", "-o", f"squirrelbattle/locale/{language}/LC_MESSAGES" "/squirrelbattle.mo", diff --git a/docs/translation.rst b/docs/translation.rst index ab3da46..f3d2584 100644 --- a/docs/translation.rst +++ b/docs/translation.rst @@ -1,7 +1,7 @@ Traduction ========== -Le jeu Squirrel Battle est entièrement traduit en anglais et en français. +Le jeu Squirrel Battle est entièrement traduit en anglais, en français et en allement. La langue se choisit dans les `paramètres `_. diff --git a/setup.py b/setup.py index b9e493a..f051bbb 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ with open("README.md", "r") as f: long_description = f.read() # Compile messages -for language in ["en", "fr"]: +for language in ["de", "en", "fr"]: args = ["msgfmt", "--check-format", "-o", f"squirrelbattle/locale/{language}/LC_MESSAGES" "/squirrelbattle.mo", diff --git a/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po b/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po new file mode 100644 index 0000000..dfd3365 --- /dev/null +++ b/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po @@ -0,0 +1,166 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse +# This file is distributed under the same license as the squirrelbattle package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: squirrelbattle 3.14.1\n" +"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n" +"POT-Creation-Date: 2020-11-28 16:03+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: squirrelbattle/tests/game_test.py:284 squirrelbattle/tests/game_test.py:287 +#: squirrelbattle/tests/translations_test.py:16 +msgid "New game" +msgstr "Neu Spiel" + +#: squirrelbattle/tests/translations_test.py:17 +msgid "Resume" +msgstr "Weitergehen" + +#: squirrelbattle/tests/translations_test.py:18 +msgid "Load" +msgstr "Laden" + +#: squirrelbattle/tests/translations_test.py:19 +msgid "Save" +msgstr "Speichern" + +#: squirrelbattle/tests/translations_test.py:20 +msgid "Settings" +msgstr "Einstellungen" + +#: squirrelbattle/tests/translations_test.py:21 +msgid "Exit" +msgstr "Verlassen" + +#: squirrelbattle/tests/translations_test.py:27 +msgid "Main key to move up" +msgstr "Haupttaste zum Obengehen" + +#: squirrelbattle/tests/translations_test.py:29 +msgid "Secondary key to move up" +msgstr "Sekundärtaste zum Obengehen" + +#: squirrelbattle/tests/translations_test.py:31 +msgid "Main key to move down" +msgstr "Haupttaste zum Untergehen" + +#: squirrelbattle/tests/translations_test.py:33 +msgid "Secondary key to move down" +msgstr "Sekundärtaste zum Untergehen" + +#: squirrelbattle/tests/translations_test.py:35 +msgid "Main key to move left" +msgstr "Haupttaste zum Linksgehen" + +#: squirrelbattle/tests/translations_test.py:37 +msgid "Secondary key to move left" +msgstr "Sekundärtaste zum Linksgehen" + +#: squirrelbattle/tests/translations_test.py:39 +msgid "Main key to move right" +msgstr "Haupttaste zum Rechtsgehen" + +#: squirrelbattle/tests/translations_test.py:41 +msgid "Secondary key to move right" +msgstr "Sekundärtaste zum Rechtsgehen" + +#: squirrelbattle/tests/translations_test.py:43 +msgid "Key to validate a menu" +msgstr "Menütaste" + +#: squirrelbattle/tests/translations_test.py:45 +msgid "Texture pack" +msgstr "Textur-Packung" + +#: squirrelbattle/tests/translations_test.py:46 +msgid "Language" +msgstr "Sprache" + +#: squirrelbattle/tests/translations_test.py:49 +msgid "player" +msgstr "Spieler" + +#: squirrelbattle/tests/translations_test.py:51 +msgid "tiger" +msgstr "Tiger" + +#: squirrelbattle/tests/translations_test.py:52 +msgid "hedgehog" +msgstr "Igel" + +#: squirrelbattle/tests/translations_test.py:53 +msgid "rabbit" +msgstr "Kanninchen" + +#: squirrelbattle/tests/translations_test.py:54 +msgid "teddy bear" +msgstr "Teddybär" + +#: squirrelbattle/tests/translations_test.py:56 +msgid "bomb" +msgstr "Bombe" + +#: squirrelbattle/tests/translations_test.py:57 +msgid "heart" +msgstr "Herz" + +#: squirrelbattle/display/statsdisplay.py:34 +msgid "Inventory:" +msgstr "Bestand:" + +#: squirrelbattle/display/statsdisplay.py:39 +msgid "YOU ARE DEAD" +msgstr "SIE WURDEN GESTORBEN" + +#: squirrelbattle/interfaces.py:398 +#, python-brace-format +msgid "{name} hits {opponent}." +msgstr "{name} schlägt {opponent}." + +#: squirrelbattle/interfaces.py:410 +#, python-brace-format +msgid "{name} takes {amount} damage." +msgstr "{name} nimmt {amount} Schadenspunkte." + +#: squirrelbattle/interfaces.py:412 +#, python-brace-format +msgid "{name} dies." +msgstr "{name} stirbt." + +#: squirrelbattle/menus.py:71 +msgid "Back" +msgstr "Zurück" + +#: squirrelbattle/game.py:148 +msgid "" +"Some keys are missing in your save file.\n" +"Your save seems to be corrupt. It got deleted." +msgstr "" +"In Ihrer Speicherdatei fehlen einige Schlüssel.\n" +"Ihre Speicherung scheint korrupt zu sein. Es wird gelöscht." + +#: squirrelbattle/game.py:156 +msgid "" +"No player was found on this map!\n" +"Maybe you died?" +msgstr "" +"Auf dieser Karte wurde kein Spieler gefunden!\n" +"Vielleicht sind Sie gestorben?" + +#: squirrelbattle/game.py:176 +msgid "" +"The JSON file is not correct.\n" +"Your save seems corrupted. It got deleted." +msgstr "" +"Die JSON-Datei ist nicht korrekt.\n" +"Ihre Speicherung scheint korrumpiert. Sie wurde gelöscht." diff --git a/squirrelbattle/locale/en/LC_MESSAGES/squirrelbattle.po b/squirrelbattle/locale/en/LC_MESSAGES/squirrelbattle.po index 9600c79..3f563fa 100644 --- a/squirrelbattle/locale/en/LC_MESSAGES/squirrelbattle.po +++ b/squirrelbattle/locale/en/LC_MESSAGES/squirrelbattle.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: squirrelbattle 3.14.1\n" "Report-Msgid-Bugs-To: squirrel-battle@crans.org\n" -"POT-Creation-Date: 2020-11-28 03:01+0100\n" +"POT-Creation-Date: 2020-11-28 16:03+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -37,26 +37,32 @@ msgstr "" #: squirrelbattle/menus.py:45 squirrelbattle/tests/translations_test.py:14 #: squirrelbattle/tests/game_test.py:284 squirrelbattle/tests/game_test.py:287 +#: squirrelbattle/tests/translations_test.py:16 msgid "New game" msgstr "" #: squirrelbattle/menus.py:46 squirrelbattle/tests/translations_test.py:15 +#: squirrelbattle/tests/translations_test.py:17 msgid "Resume" msgstr "" #: squirrelbattle/menus.py:47 squirrelbattle/tests/translations_test.py:17 +#: squirrelbattle/tests/translations_test.py:19 msgid "Save" msgstr "" #: squirrelbattle/menus.py:48 squirrelbattle/tests/translations_test.py:16 +#: squirrelbattle/tests/translations_test.py:18 msgid "Load" msgstr "" #: squirrelbattle/menus.py:49 squirrelbattle/tests/translations_test.py:18 +#: squirrelbattle/tests/translations_test.py:20 msgid "Settings" msgstr "" #: squirrelbattle/menus.py:50 squirrelbattle/tests/translations_test.py:19 +#: squirrelbattle/tests/translations_test.py:21 msgid "Exit" msgstr "" @@ -84,56 +90,67 @@ msgstr "" #: squirrelbattle/settings.py:21 squirrelbattle/tests/translations_test.py:21 #: squirrelbattle/tests/translations_test.py:25 +#: squirrelbattle/tests/translations_test.py:27 msgid "Main key to move up" msgstr "" #: squirrelbattle/settings.py:22 squirrelbattle/tests/translations_test.py:23 #: squirrelbattle/tests/translations_test.py:27 +#: squirrelbattle/tests/translations_test.py:29 msgid "Secondary key to move up" msgstr "" #: squirrelbattle/settings.py:23 squirrelbattle/tests/translations_test.py:25 #: squirrelbattle/tests/translations_test.py:29 +#: squirrelbattle/tests/translations_test.py:31 msgid "Main key to move down" msgstr "" #: squirrelbattle/settings.py:24 squirrelbattle/tests/translations_test.py:27 #: squirrelbattle/tests/translations_test.py:31 +#: squirrelbattle/tests/translations_test.py:33 msgid "Secondary key to move down" msgstr "" #: squirrelbattle/settings.py:25 squirrelbattle/tests/translations_test.py:29 #: squirrelbattle/tests/translations_test.py:33 +#: squirrelbattle/tests/translations_test.py:35 msgid "Main key to move left" msgstr "" #: squirrelbattle/settings.py:26 squirrelbattle/tests/translations_test.py:31 #: squirrelbattle/tests/translations_test.py:35 +#: squirrelbattle/tests/translations_test.py:37 msgid "Secondary key to move left" msgstr "" #: squirrelbattle/settings.py:27 squirrelbattle/tests/translations_test.py:33 #: squirrelbattle/tests/translations_test.py:37 +#: squirrelbattle/tests/translations_test.py:39 msgid "Main key to move right" msgstr "" #: squirrelbattle/settings.py:29 squirrelbattle/tests/translations_test.py:35 #: squirrelbattle/tests/translations_test.py:39 +#: squirrelbattle/tests/translations_test.py:41 msgid "Secondary key to move right" msgstr "" #: squirrelbattle/settings.py:30 squirrelbattle/tests/translations_test.py:37 #: squirrelbattle/tests/translations_test.py:41 +#: squirrelbattle/tests/translations_test.py:43 msgid "Key to validate a menu" msgstr "" #: squirrelbattle/settings.py:31 squirrelbattle/tests/translations_test.py:39 #: squirrelbattle/tests/translations_test.py:43 +#: squirrelbattle/tests/translations_test.py:45 msgid "Texture pack" msgstr "" #: squirrelbattle/settings.py:32 squirrelbattle/tests/translations_test.py:40 #: squirrelbattle/tests/translations_test.py:44 +#: squirrelbattle/tests/translations_test.py:46 msgid "Language" msgstr "" @@ -143,29 +160,36 @@ msgid "{name} dies." msgstr "" #: squirrelbattle/tests/translations_test.py:47 +#: squirrelbattle/tests/translations_test.py:49 msgid "player" msgstr "" #: squirrelbattle/tests/translations_test.py:49 +#: squirrelbattle/tests/translations_test.py:51 msgid "tiger" msgstr "" #: squirrelbattle/tests/translations_test.py:50 +#: squirrelbattle/tests/translations_test.py:52 msgid "hedgehog" msgstr "" #: squirrelbattle/tests/translations_test.py:51 +#: squirrelbattle/tests/translations_test.py:53 msgid "rabbit" msgstr "" #: squirrelbattle/tests/translations_test.py:52 +#: squirrelbattle/tests/translations_test.py:54 msgid "teddy bear" msgstr "" #: squirrelbattle/tests/translations_test.py:54 +#: squirrelbattle/tests/translations_test.py:56 msgid "bomb" msgstr "" #: squirrelbattle/tests/translations_test.py:55 +#: squirrelbattle/tests/translations_test.py:57 msgid "heart" msgstr "" diff --git a/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po b/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po index b14ef50..d46cee6 100644 --- a/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po +++ b/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: squirrelbattle 3.14.1\n" "Report-Msgid-Bugs-To: squirrel-battle@crans.org\n" -"POT-Creation-Date: 2020-11-28 02:50+0100\n" +"POT-Creation-Date: 2020-11-28 16:03+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -37,26 +37,32 @@ msgstr "{name} prend {amount} points de dégât." #: squirrelbattle/menus.py:45 squirrelbattle/tests/translations_test.py:14 #: squirrelbattle/tests/game_test.py:284 squirrelbattle/tests/game_test.py:287 +#: squirrelbattle/tests/translations_test.py:16 msgid "New game" msgstr "Nouvelle partie" #: squirrelbattle/menus.py:46 squirrelbattle/tests/translations_test.py:15 +#: squirrelbattle/tests/translations_test.py:17 msgid "Resume" msgstr "Continuer" #: squirrelbattle/menus.py:47 squirrelbattle/tests/translations_test.py:17 +#: squirrelbattle/tests/translations_test.py:19 msgid "Save" msgstr "Sauvegarder" #: squirrelbattle/menus.py:48 squirrelbattle/tests/translations_test.py:16 +#: squirrelbattle/tests/translations_test.py:18 msgid "Load" msgstr "Charger" #: squirrelbattle/menus.py:49 squirrelbattle/tests/translations_test.py:18 +#: squirrelbattle/tests/translations_test.py:20 msgid "Settings" msgstr "Paramètres" #: squirrelbattle/menus.py:50 squirrelbattle/tests/translations_test.py:19 +#: squirrelbattle/tests/translations_test.py:21 msgid "Exit" msgstr "Quitter" @@ -90,56 +96,67 @@ msgstr "" #: squirrelbattle/settings.py:21 squirrelbattle/tests/translations_test.py:21 #: squirrelbattle/tests/translations_test.py:25 +#: squirrelbattle/tests/translations_test.py:27 msgid "Main key to move up" msgstr "Touche principale pour aller vers le haut" #: squirrelbattle/settings.py:22 squirrelbattle/tests/translations_test.py:23 #: squirrelbattle/tests/translations_test.py:27 +#: squirrelbattle/tests/translations_test.py:29 msgid "Secondary key to move up" msgstr "Touche secondaire pour aller vers le haut" #: squirrelbattle/settings.py:23 squirrelbattle/tests/translations_test.py:25 #: squirrelbattle/tests/translations_test.py:29 +#: squirrelbattle/tests/translations_test.py:31 msgid "Main key to move down" msgstr "Touche principale pour aller vers le bas" #: squirrelbattle/settings.py:24 squirrelbattle/tests/translations_test.py:27 #: squirrelbattle/tests/translations_test.py:31 +#: squirrelbattle/tests/translations_test.py:33 msgid "Secondary key to move down" msgstr "Touche secondaire pour aller vers le bas" #: squirrelbattle/settings.py:25 squirrelbattle/tests/translations_test.py:29 #: squirrelbattle/tests/translations_test.py:33 +#: squirrelbattle/tests/translations_test.py:35 msgid "Main key to move left" msgstr "Touche principale pour aller vers la gauche" #: squirrelbattle/settings.py:26 squirrelbattle/tests/translations_test.py:31 #: squirrelbattle/tests/translations_test.py:35 +#: squirrelbattle/tests/translations_test.py:37 msgid "Secondary key to move left" msgstr "Touche secondaire pour aller vers la gauche" #: squirrelbattle/settings.py:27 squirrelbattle/tests/translations_test.py:33 #: squirrelbattle/tests/translations_test.py:37 +#: squirrelbattle/tests/translations_test.py:39 msgid "Main key to move right" msgstr "Touche principale pour aller vers la droite" #: squirrelbattle/settings.py:29 squirrelbattle/tests/translations_test.py:35 #: squirrelbattle/tests/translations_test.py:39 +#: squirrelbattle/tests/translations_test.py:41 msgid "Secondary key to move right" msgstr "Touche secondaire pour aller vers la droite" #: squirrelbattle/settings.py:30 squirrelbattle/tests/translations_test.py:37 #: squirrelbattle/tests/translations_test.py:41 +#: squirrelbattle/tests/translations_test.py:43 msgid "Key to validate a menu" msgstr "Touche pour valider un menu" #: squirrelbattle/settings.py:31 squirrelbattle/tests/translations_test.py:39 #: squirrelbattle/tests/translations_test.py:43 +#: squirrelbattle/tests/translations_test.py:45 msgid "Texture pack" msgstr "Pack de textures" #: squirrelbattle/settings.py:32 squirrelbattle/tests/translations_test.py:40 #: squirrelbattle/tests/translations_test.py:44 +#: squirrelbattle/tests/translations_test.py:46 msgid "Language" msgstr "Langue" @@ -149,29 +166,36 @@ msgid "{name} dies." msgstr "{name} meurt." #: squirrelbattle/tests/translations_test.py:47 +#: squirrelbattle/tests/translations_test.py:49 msgid "player" msgstr "joueur" #: squirrelbattle/tests/translations_test.py:49 +#: squirrelbattle/tests/translations_test.py:51 msgid "tiger" msgstr "tigre" #: squirrelbattle/tests/translations_test.py:50 +#: squirrelbattle/tests/translations_test.py:52 msgid "hedgehog" msgstr "hérisson" #: squirrelbattle/tests/translations_test.py:51 +#: squirrelbattle/tests/translations_test.py:53 msgid "rabbit" msgstr "lapin" #: squirrelbattle/tests/translations_test.py:52 +#: squirrelbattle/tests/translations_test.py:54 msgid "teddy bear" msgstr "nounours" #: squirrelbattle/tests/translations_test.py:54 +#: squirrelbattle/tests/translations_test.py:56 msgid "bomb" msgstr "bombe" #: squirrelbattle/tests/translations_test.py:55 +#: squirrelbattle/tests/translations_test.py:57 msgid "heart" msgstr "cœur" diff --git a/squirrelbattle/menus.py b/squirrelbattle/menus.py index 1fba7ea..4fcfabe 100644 --- a/squirrelbattle/menus.py +++ b/squirrelbattle/menus.py @@ -98,7 +98,7 @@ class SettingsMenu(Menu): self.update_values(game.settings) elif option == "LOCALE": game.settings.LOCALE = 'fr' if game.settings.LOCALE == 'en'\ - else 'en' + else 'de' if game.settings.LOCALE == 'fr' else 'en' Translator.setlocale(game.settings.LOCALE) game.settings.write_settings() self.update_values(game.settings) diff --git a/squirrelbattle/tests/game_test.py b/squirrelbattle/tests/game_test.py index 9c950d6..a23b6f9 100644 --- a/squirrelbattle/tests/game_test.py +++ b/squirrelbattle/tests/game_test.py @@ -283,6 +283,9 @@ class TestGame(unittest.TestCase): self.assertEqual(self.game.settings.LOCALE, "fr") self.assertEqual(_("New game"), "Nouvelle partie") self.game.handle_key_pressed(KeyValues.ENTER) + self.assertEqual(self.game.settings.LOCALE, "de") + self.assertEqual(_("New game"), "Neu Spiel") + self.game.handle_key_pressed(KeyValues.ENTER) self.assertEqual(self.game.settings.LOCALE, "en") self.assertEqual(_("New game"), "New game") diff --git a/squirrelbattle/translations.py b/squirrelbattle/translations.py index cd5b7fc..f532bb0 100644 --- a/squirrelbattle/translations.py +++ b/squirrelbattle/translations.py @@ -14,7 +14,7 @@ class Translator: Translator.setlocale defines the language of the strings, then gettext() translates the message. """ - SUPPORTED_LOCALES: List[str] = ["en", "fr"] + SUPPORTED_LOCALES: List[str] = ["de", "en", "fr"] locale: str = "en" translators: dict = {}