From 573ce3fb18d01554878ed30c21ff6b36bafdcd6a Mon Sep 17 00:00:00 2001 From: Romain J Date: Tue, 19 Jan 2021 15:03:05 +0100 Subject: [PATCH] feat(commands|Custom>alias;locale): translations --- tuxbot/cogs/Admin/locales/messages.pot | 4 +- tuxbot/cogs/Custom/functions/converters.py | 9 +++-- tuxbot/cogs/Custom/locales/en-US.po | 12 +++--- tuxbot/cogs/Custom/locales/fr-FR.po | 45 ++++++++++++++++++---- tuxbot/cogs/Custom/locales/messages.pot | 37 ++++++++++++++++-- tuxbot/cogs/Utils/locales/messages.pot | 2 +- tuxbot/core/bot.py | 2 +- 7 files changed, 86 insertions(+), 25 deletions(-) diff --git a/tuxbot/cogs/Admin/locales/messages.pot b/tuxbot/cogs/Admin/locales/messages.pot index f2b176e..3b89287 100644 --- a/tuxbot/cogs/Admin/locales/messages.pot +++ b/tuxbot/cogs/Admin/locales/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Tuxbot-bot\n" "Report-Msgid-Bugs-To: rick@gnous.eu\n" -"POT-Creation-Date: 2020-11-11 16:42+0100\n" +"POT-Creation-Date: 2021-01-19 14:42+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -22,6 +22,6 @@ msgstr "" msgid "Locale changed to {lang} successfully" msgstr "" -#: tuxbot/cogs/Admin/admin.py:65 +#: tuxbot/cogs/Admin/admin.py:61 msgid "List of available locales: " msgstr "" diff --git a/tuxbot/cogs/Custom/functions/converters.py b/tuxbot/cogs/Custom/functions/converters.py index 302f548..d5fd6fc 100644 --- a/tuxbot/cogs/Custom/functions/converters.py +++ b/tuxbot/cogs/Custom/functions/converters.py @@ -2,13 +2,16 @@ from discord.ext import commands from jishaku.models import copy_context_with +_ = lambda x: x + + class AliasConvertor(commands.Converter): async def convert(self, ctx, argument): args = argument.split(" | ") if len(args) <= 1: raise commands.BadArgument( - "Alias must be like `[command] | [alias]`" + _("Alias must be like `[command] | [alias]`") ) command_ctx = await copy_context_with( @@ -17,9 +20,9 @@ class AliasConvertor(commands.Converter): alias_ctx = await copy_context_with(ctx, content=ctx.prefix + args[1]) if command_ctx.command is None: - raise commands.BadArgument(f"Unknown command `{args[0]}`") + raise commands.BadArgument(_(f"Unknown command `{args[0]}`")) if alias_ctx.command is not None: - raise commands.BadArgument(f"Command `{args[1]}` already exists") + raise commands.BadArgument(_(f"Command `{args[1]}` already exists")) return argument diff --git a/tuxbot/cogs/Custom/locales/en-US.po b/tuxbot/cogs/Custom/locales/en-US.po index 25a4a1e..0d5a557 100644 --- a/tuxbot/cogs/Custom/locales/en-US.po +++ b/tuxbot/cogs/Custom/locales/en-US.po @@ -1,4 +1,5 @@ -# English translations for Tuxbot-bot package. +# French translations for Tuxbot-bot package +# Traductions françaises du paquet Tuxbot-bot. # Copyright (C) 2020 THE Tuxbot-bot'S COPYRIGHT HOLDER # This file is distributed under the same license as the Tuxbot-bot package. # Automatically generated, 2020. @@ -7,16 +8,15 @@ msgid "" msgstr "" "Project-Id-Version: Tuxbot-bot\n" "Report-Msgid-Bugs-To: rick@gnous.eu\n" -"POT-Creation-Date: 2020-11-11 02:40+0100\n" -"PO-Revision-Date: 2020-06-10 00:38+0200\n" +"POT-Creation-Date: 2021-01-19 14:39+0100\n" +"PO-Revision-Date: 2021-01-19 14:39+0100\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" -"Language: en_US\n" +"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - +"Plural-Forms: nplurals=2; plural=(n > 1);\n" #: tuxbot/cogs/Admin/admin.py:50 #, python-brace-format msgid "Locale changed to {lang} successfully" diff --git a/tuxbot/cogs/Custom/locales/fr-FR.po b/tuxbot/cogs/Custom/locales/fr-FR.po index 2b14077..94a800c 100644 --- a/tuxbot/cogs/Custom/locales/fr-FR.po +++ b/tuxbot/cogs/Custom/locales/fr-FR.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: Tuxbot-bot\n" "Report-Msgid-Bugs-To: rick@gnous.eu\n" -"POT-Creation-Date: 2020-11-11 02:40+0100\n" -"PO-Revision-Date: 2020-06-10 00:38+0200\n" +"POT-Creation-Date: 2021-01-19 14:39+0100\n" +"PO-Revision-Date: 2021-01-19 14:39+0100\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" "Language: fr\n" @@ -18,11 +18,40 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: tuxbot/cogs/Admin/admin.py:50 -#, fuzzy, python-brace-format -msgid "Locale changed to {lang} successfully" -msgstr "Langue changée pour {lang} avec succès" +#: tuxbot/cogs/Custom/custom.py:69 +#, python-brace-format +msgid "Locale changed for you to {lang} successfully" +msgstr "Langue changée pour vous en {lang} avec succès" -#: tuxbot/cogs/Admin/admin.py:65 +#: tuxbot/cogs/Custom/custom.py:76 msgid "List of available locales: " -msgstr "Liste des langues disponibles : " +msgstr "Liste des langues disponibles: " + +#: tuxbot/cogs/Custom/custom.py:95 +#, python-brace-format +msgid "The alias `{alias}` is already defined for the command `{command}`" +msgstr "L'alias `{alias}` est déjà défini pour la commande `{command}`" + +#: tuxbot/cogs/Custom/custom.py:105 +#, python-brace-format +msgid "There is already an alias for `{command}` which is `{alias}`" +msgstr "Il existe déjà un alias pour `{command}`, qui est `{alias}`" + +#: tuxbot/cogs/Custom/custom.py:123 +#, python-brace-format +msgid "The alias `{alias}` for the command `{command}` was successfully created" +msgstr "L'alias `{alias}` pour la commande `{command}` a été créé avec succès" + +#: tuxbot/cogs/Custom/functions/converters.py:14 +msgid "Alias must be like `[command] | [alias]`" +msgstr "L'alias doit être comme `[command] | [alias" + +#: tuxbot/cogs/Custom/functions/converters.py:23 +#, python-brace-format +msgid "Unknown command `{args[0]}`" +msgstr "Commande `{args[0]}` inconnue" + +#: tuxbot/cogs/Custom/functions/converters.py:26 +#, python-brace-format +msgid "Command `{args[1]}` already exists" +msgstr "La commande `{args[1]}` existe déjà" diff --git a/tuxbot/cogs/Custom/locales/messages.pot b/tuxbot/cogs/Custom/locales/messages.pot index f2b176e..d34e30d 100644 --- a/tuxbot/cogs/Custom/locales/messages.pot +++ b/tuxbot/cogs/Custom/locales/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Tuxbot-bot\n" "Report-Msgid-Bugs-To: rick@gnous.eu\n" -"POT-Creation-Date: 2020-11-11 16:42+0100\n" +"POT-Creation-Date: 2021-01-19 14:42+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,11 +17,40 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: tuxbot/cogs/Admin/admin.py:50 +#: tuxbot/cogs/Custom/custom.py:69 #, python-brace-format -msgid "Locale changed to {lang} successfully" +msgid "Locale changed for you to {lang} successfully" msgstr "" -#: tuxbot/cogs/Admin/admin.py:65 +#: tuxbot/cogs/Custom/custom.py:76 msgid "List of available locales: " msgstr "" + +#: tuxbot/cogs/Custom/custom.py:95 +#, python-brace-format +msgid "The alias `{alias}` is already defined for the command `{command}`" +msgstr "" + +#: tuxbot/cogs/Custom/custom.py:105 +#, python-brace-format +msgid "There is already an alias for `{command}` which is `{alias}`" +msgstr "" + +#: tuxbot/cogs/Custom/custom.py:123 +#, python-brace-format +msgid "The alias `{alias}` for the command `{command}` was successfully created" +msgstr "" + +#: tuxbot/cogs/Custom/functions/converters.py:14 +msgid "Alias must be like `[command] | [alias]`" +msgstr "" + +#: tuxbot/cogs/Custom/functions/converters.py:23 +#, python-brace-format +msgid "Unknown command `{args[0]}`" +msgstr "" + +#: tuxbot/cogs/Custom/functions/converters.py:26 +#, python-brace-format +msgid "Command `{args[1]}` already exists" +msgstr "" diff --git a/tuxbot/cogs/Utils/locales/messages.pot b/tuxbot/cogs/Utils/locales/messages.pot index 31a4f39..02a0484 100644 --- a/tuxbot/cogs/Utils/locales/messages.pot +++ b/tuxbot/cogs/Utils/locales/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Tuxbot-bot\n" "Report-Msgid-Bugs-To: rick@gnous.eu\n" -"POT-Creation-Date: 2020-11-11 16:42+0100\n" +"POT-Creation-Date: 2021-01-19 14:42+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/tuxbot/core/bot.py b/tuxbot/core/bot.py index c5dd805..50b3437 100644 --- a/tuxbot/core/bot.py +++ b/tuxbot/core/bot.py @@ -41,7 +41,7 @@ packages: List[str] = [ "jishaku", "tuxbot.cogs.Admin", "tuxbot.cogs.Logs", - "tuxbot.cogs.Dev", + # "tuxbot.cogs.Dev", "tuxbot.cogs.Utils", "tuxbot.cogs.Polls", "tuxbot.cogs.Custom",