From fdc2bcab8dc037c43d49481fe0f17e8ca7950923 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 7 Dec 2020 01:01:39 +0100 Subject: [PATCH] Add spanish translation --- docs/deployment.rst | 2 +- setup.py | 2 +- .../locale/de/LC_MESSAGES/squirrelbattle.po | 4 +- .../locale/es/LC_MESSAGES/squirrelbattle.po | 206 ++++++++++++++++++ .../locale/fr/LC_MESSAGES/squirrelbattle.po | 5 +- squirrelbattle/menus.py | 3 +- squirrelbattle/tests/game_test.py | 3 + squirrelbattle/translations.py | 4 +- 8 files changed, 218 insertions(+), 11 deletions(-) create mode 100644 squirrelbattle/locale/es/LC_MESSAGES/squirrelbattle.po diff --git a/docs/deployment.rst b/docs/deployment.rst index 9477a10..6bde6f0 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 ["de", "en", "fr"]: + for language in ["de", "es", "fr"]: args = ["msgfmt", "--check-format", "-o", f"squirrelbattle/locale/{language}/LC_MESSAGES" "/squirrelbattle.mo", diff --git a/setup.py b/setup.py index 573eea7..7f39d83 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 ["de", "fr"]: +for language in ["de", "es", "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 index 28307eb..38d16a6 100644 --- a/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po +++ b/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po @@ -1,9 +1,7 @@ -# SOME DESCRIPTIVE TITLE. +# German translation of Squirrel Battle # 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" diff --git a/squirrelbattle/locale/es/LC_MESSAGES/squirrelbattle.po b/squirrelbattle/locale/es/LC_MESSAGES/squirrelbattle.po new file mode 100644 index 0000000..acbfb5a --- /dev/null +++ b/squirrelbattle/locale/es/LC_MESSAGES/squirrelbattle.po @@ -0,0 +1,206 @@ +# Spanish translation of Squirrel Battle +# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse +# This file is distributed under the same license as the squirrelbattle package. +# Translation by ifugaao +# +msgid "" +msgstr "" +"Project-Id-Version: squirrelbattle 3.14.1\n" +"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n" +"POT-Creation-Date: 2020-12-05 14:46+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: ifugao\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" + +# Suggested in Weblate: == INVENTORIO == +#: squirrelbattle/display/menudisplay.py:105 +msgid "== INVENTORY ==" +msgstr "== INVENTORIO ==" + +# Suggested in Weblate: Inventorio : +#: squirrelbattle/display/statsdisplay.py:34 +msgid "Inventory:" +msgstr "Inventorio :" + +# Suggested in Weblate: ERES MUERTO +#: squirrelbattle/display/statsdisplay.py:50 +msgid "YOU ARE DEAD" +msgstr "ERES MUERTO" + +#. The bomb is exploding. +#. Each entity that is close to the bomb takes damages. +#. The player earn XP if the entity was killed. +#: squirrelbattle/entities/items.py:128 +msgid "Bomb is exploding." +msgstr "La bomba está explotando." + +#: squirrelbattle/entities/items.py:172 +#, python-brace-format +msgid "{player} exchanged its body with {entity}." +msgstr "{player} intercambió su cuerpo con {entity}." + +#: squirrelbattle/game.py:177 +msgid "" +"Some keys are missing in your save file.\n" +"Your save seems to be corrupt. It got deleted." +msgstr "" +"Algunas claves faltan en su archivo de guarda.\n" +"Su guarda parece a ser corruptido. Fue eliminado." + +#: squirrelbattle/game.py:185 +msgid "" +"No player was found on this map!\n" +"Maybe you died?" +msgstr "" +"No jugador encontrado sobre la carta !\n" +"¿ Quizas murió ?" + +#: squirrelbattle/game.py:205 +msgid "" +"The JSON file is not correct.\n" +"Your save seems corrupted. It got deleted." +msgstr "" +"El JSON archivo no es correcto.\n" +"Su guarda parece corrupta. Fue eliminada." + +#: squirrelbattle/interfaces.py:400 +#, python-brace-format +msgid "{name} hits {opponent}." +msgstr "{name} golpea a {opponent}." + +#: squirrelbattle/interfaces.py:412 +#, python-brace-format +msgid "{name} takes {amount} damage." +msgstr "{name} recibe {amount} daño." + +#: squirrelbattle/interfaces.py:414 +#, python-brace-format +msgid "{name} dies." +msgstr "{name} se muere." + +#: squirrelbattle/menus.py:72 +msgid "Back" +msgstr "Volver" + +#: squirrelbattle/tests/game_test.py:300, +#: squirrelbattle/tests/game_test.py:303, +#: squirrelbattle/tests/game_test.py:306, +#: squirrelbattle/tests/translations_test.py:16 +msgid "New game" +msgstr "Nuevo partido" + +#: squirrelbattle/tests/translations_test.py:17 +msgid "Resume" +msgstr "Resumir" + +#: squirrelbattle/tests/translations_test.py:18 +msgid "Load" +msgstr "Cargar" + +#: squirrelbattle/tests/translations_test.py:19 +msgid "Save" +msgstr "Guardar" + +#: squirrelbattle/tests/translations_test.py:20 +msgid "Settings" +msgstr "Parametros" + +#: squirrelbattle/tests/translations_test.py:21 +msgid "Exit" +msgstr "Salir" + +#: squirrelbattle/tests/translations_test.py:27 +msgid "Main key to move up" +msgstr "Primera tecla para subir" + +#: squirrelbattle/tests/translations_test.py:29 +msgid "Secondary key to move up" +msgstr "Segunda tecla para subir" + +#: squirrelbattle/tests/translations_test.py:31 +msgid "Main key to move down" +msgstr "Primera tecla para bajar" + +#: squirrelbattle/tests/translations_test.py:33 +msgid "Secondary key to move down" +msgstr "Segunda tecla para bajar" + +#: squirrelbattle/tests/translations_test.py:35 +msgid "Main key to move left" +msgstr "Primera tecla para moverse a la izquierda" + +#: squirrelbattle/tests/translations_test.py:37 +msgid "Secondary key to move left" +msgstr "Segunda tecla para moverse a la izquierda" + +#: squirrelbattle/tests/translations_test.py:39 +msgid "Main key to move right" +msgstr "Primera tecla para moverse a la derecha" + +#: squirrelbattle/tests/translations_test.py:41 +msgid "Secondary key to move right" +msgstr "Segunda tecla para moverse a la derecha" + +#: squirrelbattle/tests/translations_test.py:43 +msgid "Key to validate a menu" +msgstr "Tecla para validar un menú" + +#: squirrelbattle/tests/translations_test.py:45 +msgid "Key used to open the inventory" +msgstr "Tecla para abrir el inventorio" + +#: squirrelbattle/tests/translations_test.py:47 +msgid "Key used to use an item in the inventory" +msgstr "Tecla para utilizar un objeto del inventorio" + +#: squirrelbattle/tests/translations_test.py:49 +msgid "Key used to equip an item in the inventory" +msgstr "Tecla para equipar un objeto del inventorio" + +#: squirrelbattle/tests/translations_test.py:51 +msgid "Key used to drop an item in the inventory" +msgstr "Tecla para dejar un objeto del inventorio" + +#: squirrelbattle/tests/translations_test.py:53 +msgid "Texture pack" +msgstr "Paquete de texturas" + +#: squirrelbattle/tests/translations_test.py:54 +msgid "Language" +msgstr "Languaje" + +#: squirrelbattle/tests/translations_test.py:57 +msgid "player" +msgstr "jugador" + +#: squirrelbattle/tests/translations_test.py:59 +msgid "tiger" +msgstr "tigre" + +#: squirrelbattle/tests/translations_test.py:60 +msgid "hedgehog" +msgstr "erizo" + +#: squirrelbattle/tests/translations_test.py:61 +msgid "rabbit" +msgstr "conejo" + +#: squirrelbattle/tests/translations_test.py:62 +msgid "teddy bear" +msgstr "osito de peluche" + +#: squirrelbattle/tests/translations_test.py:64 +msgid "body snatch potion" +msgstr "poción de intercambio" + +#: squirrelbattle/tests/translations_test.py:65 +msgid "bomb" +msgstr "bomba" + +#: squirrelbattle/tests/translations_test.py:66 +msgid "heart" +msgstr "corazón" diff --git a/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po b/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po index 652871d..85bd728 100644 --- a/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po +++ b/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po @@ -1,7 +1,6 @@ -# SOME DESCRIPTIVE TITLE. +# French translation of Squirrel Battle # 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 "" @@ -12,7 +11,7 @@ msgstr "" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -"Language: \n" +"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/squirrelbattle/menus.py b/squirrelbattle/menus.py index d6946d0..3a536f3 100644 --- a/squirrelbattle/menus.py +++ b/squirrelbattle/menus.py @@ -99,7 +99,8 @@ class SettingsMenu(Menu): self.update_values(game.settings) elif option == "LOCALE": game.settings.LOCALE = 'fr' if game.settings.LOCALE == 'en'\ - else 'de' if game.settings.LOCALE == 'fr' else 'en' + else 'de' if game.settings.LOCALE == 'fr' else 'es' \ + if game.settings.LOCALE == 'de' 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 887835b..3a32c95 100644 --- a/squirrelbattle/tests/game_test.py +++ b/squirrelbattle/tests/game_test.py @@ -302,6 +302,9 @@ class TestGame(unittest.TestCase): 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, "es") + self.assertEqual(_("New game"), "Nuevo partido") + 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 1e97df6..08d40d1 100644 --- a/squirrelbattle/translations.py +++ b/squirrelbattle/translations.py @@ -15,7 +15,7 @@ class Translator: Translator.setlocale defines the language of the strings, then gettext() translates the message. """ - SUPPORTED_LOCALES: List[str] = ["de", "en", "fr"] + SUPPORTED_LOCALES: List[str] = ["de", "en", "es", "fr"] locale: str = "en" translators: dict = {} @@ -67,7 +67,7 @@ class Translator: "--package-name=squirrelbattle", "--package-version=3.14.1", "--copyright-holder=ÿnérant, eichhornchen, " - "nicomarg, charlse", + "nicomarg, charlse, ifugao", "--msgid-bugs-address=squirrel-battle@crans.org", "--sort-by-file", "-o", file_name]