[i18n] Basic Implementation (#948)

* Initial commit

* Beginning of working i18n

* Add some translation files

* Add more strings to translate

* Update and add some more translations

* Update spanish translation

* Update french translation

* Add alias translation templates

* Add bank translations

* Add economy translations

* Add general translations

* Add image translations

* Add core translations
This commit is contained in:
Will
2017-08-26 18:54:51 -04:00
committed by GitHub
parent 3d76f3a787
commit 118df46630
25 changed files with 1875 additions and 245 deletions

View File

@@ -11,6 +11,7 @@ from core import Config
from core.bot import Red
from core import checks
from core.utils.chat_formatting import box
from core.i18n import CogI18n
from .repo_manager import RepoManager, Repo
from .installable import Installable
@@ -19,6 +20,8 @@ from .log import log
from .errors import CloningError, ExistingGitRepo
from .checks import install_agreement
_ = CogI18n('Downloader', __file__)
class Downloader:
def __init__(self, bot: Red):
@@ -196,12 +199,12 @@ class Downloader:
branch=branch
)
except ExistingGitRepo:
await ctx.send("That git repo has already been added under another name.")
await ctx.send(_("That git repo has already been added under another name."))
except CloningError:
await ctx.send("Something went wrong during the cloning process.")
log.exception("Something went wrong during the cloning process.")
await ctx.send(_("Something went wrong during the cloning process."))
log.exception(_("Something went wrong during the cloning process."))
else:
await ctx.send("Repo `{}` successfully added.".format(name))
await ctx.send(_("Repo `{}` successfully added.").format(name))
@repo.command(name="delete")
async def _repo_del(self, ctx, repo_name: Repo):
@@ -210,7 +213,7 @@ class Downloader:
"""
await self._repo_manager.delete_repo(repo_name.name)
await ctx.send("The repo `{}` has been deleted successfully.".format(repo_name.name))
await ctx.send(_("The repo `{}` has been deleted successfully.").format(repo_name.name))
@repo.command(name="list")
async def _repo_list(self, ctx):
@@ -218,7 +221,7 @@ class Downloader:
Lists all installed repos.
"""
repos = self._repo_manager.get_all_repo_names()
joined = "Installed Repos:\n" + "\n".join(["+ " + r for r in repos])
joined = _("Installed Repos:\n") + "\n".join(["+ " + r for r in repos])
await ctx.send(box(joined, lang="diff"))
@@ -238,13 +241,13 @@ class Downloader:
"""
cog = discord.utils.get(repo_name.available_cogs, name=cog_name)
if cog is None:
await ctx.send("Error, there is no cog by the name of"
" `{}` in the `{}` repo.".format(cog_name, repo_name.name))
await ctx.send(_("Error, there is no cog by the name of"
" `{}` in the `{}` repo.").format(cog_name, repo_name.name))
return
if not await repo_name.install_requirements(cog, self.LIB_PATH):
await ctx.send("Failed to install the required libraries for"
" `{}`: `{}`".format(cog.name, cog.requirements))
await ctx.send(_("Failed to install the required libraries for"
" `{}`: `{}`").format(cog.name, cog.requirements))
return
await repo_name.install_cog(cog, await self.cog_install_path())
@@ -253,7 +256,7 @@ class Downloader:
await repo_name.install_libraries(self.SHAREDLIB_PATH)
await ctx.send("`{}` cog successfully installed.".format(cog_name))
await ctx.send(_("`{}` cog successfully installed.").format(cog_name))
@cog.command(name="uninstall")
async def _cog_uninstall(self, ctx, cog_name: InstalledCog):
@@ -269,11 +272,11 @@ class Downloader:
await self._delete_cog(poss_installed_path)
# noinspection PyTypeChecker
await self._remove_from_installed(cog_name)
await ctx.send("`{}` was successfully removed.".format(real_name))
await ctx.send(_("`{}` was successfully removed.").format(real_name))
else:
await ctx.send("That cog was installed but can no longer"
await ctx.send(_("That cog was installed but can no longer"
" be located. You may need to remove it's"
" files manually if it is still usable.")
" files manually if it is still usable."))
@cog.command(name="update")
async def _cog_update(self, ctx, cog_name: InstalledCog=None):
@@ -295,7 +298,7 @@ class Downloader:
# noinspection PyTypeChecker
await self._reinstall_libraries(installed_and_updated)
await ctx.send("Cog update completed successfully.")
await ctx.send(_("Cog update completed successfully."))
@cog.command(name="list")
async def _cog_list(self, ctx, repo_name: Repo):
@@ -303,7 +306,7 @@ class Downloader:
Lists all available cogs from a single repo.
"""
cogs = repo_name.available_cogs
cogs = "Available Cogs:\n" + "\n".join(
cogs = _("Available Cogs:\n") + "\n".join(
["+ {}: {}".format(c.name, c.short or "") for c in cogs])
await ctx.send(box(cogs, lang="diff"))
@@ -315,12 +318,12 @@ class Downloader:
"""
cog = discord.utils.get(repo_name.available_cogs, name=cog_name)
if cog is None:
await ctx.send("There is no cog `{}` in the repo `{}`".format(
await ctx.send(_("There is no cog `{}` in the repo `{}`").format(
cog_name, repo_name.name
))
return
msg = "Information on {}:\n{}".format(cog.name, cog.description or "")
msg = _("Information on {}:\n{}").format(cog.name, cog.description or "")
await ctx.send(box(msg))
async def is_installed(self, cog_name: str) -> (bool, Union[Installable, None]):
@@ -344,7 +347,7 @@ class Downloader:
:return: str
"""
if isinstance(cog_installable, Installable):
made_by = ", ".join(cog_installable.author) or "Missing from info.json"
made_by = ", ".join(cog_installable.author) or _("Missing from info.json")
repo = self._repo_manager.get_repo(cog_installable.repo_name)
repo_url = repo.url
cog_name = cog_installable.name
@@ -353,7 +356,7 @@ class Downloader:
repo_url = "https://github.com/Twentysix26/Red-DiscordBot"
cog_name = cog_installable.__class__.__name__
msg = "Command: {}\nMade by: {}\nRepo: {}\nCog name: {}"
msg = _("Command: {}\nMade by: {}\nRepo: {}\nCog name: {}")
return msg.format(command_name, made_by, repo_url, cog_name)
@@ -377,7 +380,7 @@ class Downloader:
command = ctx.bot.all_commands.get(command_name)
if command is None:
await ctx.send("That command doesn't seem to exist.")
await ctx.send(_("That command doesn't seem to exist."))
return
# Check if in installed cogs

View File

@@ -0,0 +1,97 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2017-08-26 16:31+EDT\n"
"PO-Revision-Date: 2017-08-26 17:00-0400\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Last-Translator: tekulvw\n"
"Language-Team: \n"
"Language: de\n"
"X-Generator: Poedit 1.8.7.1\n"
#: ../downloader.py:202
msgid "That git repo has already been added under another name."
msgstr "Diese git repo wurder bereist unter einem anderem Namen hinzugefügt."
#: ../downloader.py:204 ../downloader.py:205
msgid "Something went wrong during the cloning process."
msgstr "Etwas ist beim klonen schief gelaufen."
#: ../downloader.py:207
msgid "Repo `{}` successfully added."
msgstr "Repo `{}` erfolgreich hinzugefügt."
#: ../downloader.py:216
msgid "The repo `{}` has been deleted successfully."
msgstr "Die Repo `{}` wurde erfolgreich gelöscht."
#: ../downloader.py:224
msgid "Installed Repos:\n"
msgstr "Installierte Repos:\n"
#: ../downloader.py:244
msgid "Error, there is no cog by the name of `{}` in the `{}` repo."
msgstr "Fehler: kein Cog mit dem Namen `{}` in der Repo `{}`."
#: ../downloader.py:249
msgid "Failed to install the required libraries for `{}`: `{}`"
msgstr "Installation erforderliche Abhängigkeiten für`{}` fehlgeschlagen: `{}`"
#: ../downloader.py:259
msgid "`{}` cog successfully installed."
msgstr "`{}` Cog erfolgreich installiert."
#: ../downloader.py:275
msgid "`{}` was successfully removed."
msgstr "`{}` erfolgreich entfernt."
#: ../downloader.py:277
msgid "That cog was installed but can no longer be located. You may need to remove it's files manually if it is still usable."
msgstr "Diese Cog ist installiert konnte aber nicht gefunden werden. Wenn es noch benutzbar ist kann es sein das du die Dateien manuell löschen musst."
#: ../downloader.py:301
msgid "Cog update completed successfully."
msgstr "Cog Update erfolgreich."
#: ../downloader.py:309
msgid "Available Cogs:\n"
msgstr "Vorhandene Cogs:\n"
#: ../downloader.py:321
msgid "There is no cog `{}` in the repo `{}`"
msgstr "Kein Cog namens `{}` in der Repo `{}"
#: ../downloader.py:326
msgid ""
"Information on {}:\n"
"{}"
msgstr ""
"Information zu {}:\n"
"{}"
#: ../downloader.py:350
msgid "Missing from info.json"
msgstr "Nicht in info.json"
#: ../downloader.py:359
msgid ""
"Command: {}\n"
"Made by: {}\n"
"Repo: {}\n"
"Cog name: {}"
msgstr ""
"Befehl: {}\n"
"Von: {}\n"
"Repo: {}\n"
"Cog Name: {}"
#: ../downloader.py:383
msgid "That command doesn't seem to exist."
msgstr "Dieser Befehl existiert nicht."

View File

@@ -0,0 +1,97 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2017-08-26 16:31+EDT\n"
"PO-Revision-Date: 2017-08-26 17:12-0400\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Last-Translator: tekulvw\n"
"Language-Team: \n"
"Language: es\n"
"X-Generator: Poedit 1.8.7.1\n"
#: ../downloader.py:202
msgid "That git repo has already been added under another name."
msgstr "Ese repositorio ya ha sido agregado con otro nombre."
#: ../downloader.py:204 ../downloader.py:205
msgid "Something went wrong during the cloning process."
msgstr "Algo malo ha ocurrido durante la clonación."
#: ../downloader.py:207
msgid "Repo `{}` successfully added."
msgstr "Repositorio `{}` agregado exitósamente."
#: ../downloader.py:216
msgid "The repo `{}` has been deleted successfully."
msgstr "Repositorio `{}` eliminado exitósamente."
#: ../downloader.py:224
msgid "Installed Repos:\n"
msgstr "Repositorios instalados:\n"
#: ../downloader.py:244
msgid "Error, there is no cog by the name of `{}` in the `{}` repo."
msgstr "Error: No existe un cog llamado `{}` en el repositorio `{}`."
#: ../downloader.py:249
msgid "Failed to install the required libraries for `{}`: `{}`"
msgstr "Error instalando las librerías requeridas para `{}`: `{}`"
#: ../downloader.py:259
msgid "`{}` cog successfully installed."
msgstr "`{}` instalado exitósamente."
#: ../downloader.py:275
msgid "`{}` was successfully removed."
msgstr "`{}` eliminado exitósamente."
#: ../downloader.py:277
msgid "That cog was installed but can no longer be located. You may need to remove it's files manually if it is still usable."
msgstr "El cog fue instalado pero ya no se puede localizar. Puede ser necesario eliminar sus archivos manualmente si aun es utilizable."
#: ../downloader.py:301
msgid "Cog update completed successfully."
msgstr "Cog actualizado exitósamente."
#: ../downloader.py:309
msgid "Available Cogs:\n"
msgstr "Cogs disponibles:\n"
#: ../downloader.py:321
msgid "There is no cog `{}` in the repo `{}`"
msgstr "No existe un cog `{}` en el repositorio `{}`"
#: ../downloader.py:326
msgid ""
"Information on {}:\n"
"{}"
msgstr ""
"Información sobre {}:\n"
"{}"
#: ../downloader.py:350
msgid "Missing from info.json"
msgstr "Ausente de info.json"
#: ../downloader.py:359
msgid ""
"Command: {}\n"
"Made by: {}\n"
"Repo: {}\n"
"Cog name: {}"
msgstr ""
"Comando: {}\n"
"Creado por: {}\n"
"Repositorio: {}\n"
"Nombre del cog: {}"
#: ../downloader.py:383
msgid "That command doesn't seem to exist."
msgstr "Ese comando no parece existir."

View File

@@ -0,0 +1,97 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2017-08-26 16:31+EDT\n"
"PO-Revision-Date: 2017-08-26 23:14+0200\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"X-Generator: Poedit 2.0.1\n"
#: ../downloader.py:202
msgid "That git repo has already been added under another name."
msgstr "Ce repo git a déjà été ajouté sous un autre nom"
#: ../downloader.py:204 ../downloader.py:205
msgid "Something went wrong during the cloning process."
msgstr "Quelque chose s'est mal passé pendant l'installation."
#: ../downloader.py:207
msgid "Repo `{}` successfully added."
msgstr "Le repo `{}` a été ajouté avec succès"
#: ../downloader.py:216
msgid "The repo `{}` has been deleted successfully."
msgstr "Le repo `{}` a été supprimé avec succès"
#: ../downloader.py:224
msgid "Installed Repos:\n"
msgstr "Repos installés:\n"
#: ../downloader.py:244
msgid "Error, there is no cog by the name of `{}` in the `{}` repo."
msgstr "Erreur, il n'y a pas de cog du nom de `{}` dans le repo `{}`."
#: ../downloader.py:249
msgid "Failed to install the required libraries for `{}`: `{}`"
msgstr "Échec lors de l'installation des bibliothèques de `{}`: `{}`"
#: ../downloader.py:259
msgid "`{}` cog successfully installed."
msgstr "Le cog `{}` a été ajouté avec succès"
#: ../downloader.py:275
msgid "`{}` was successfully removed."
msgstr "Le cog `{}` a été retiré avec succès"
#: ../downloader.py:277
msgid "That cog was installed but can no longer be located. You may need to remove it's files manually if it is still usable."
msgstr "Ce cog a été installé mais ne peut plus être trouvé. Vous devez retirer manuellement son dossier si il est encore utilisable."
#: ../downloader.py:301
msgid "Cog update completed successfully."
msgstr "Mise à jour du cog effectuée avec succès"
#: ../downloader.py:309
msgid "Available Cogs:\n"
msgstr "Cogs disponibles:\n"
#: ../downloader.py:321
msgid "There is no cog `{}` in the repo `{}`"
msgstr "Il n'y a pas de cog `{}` dans le repo `{}`"
#: ../downloader.py:326
msgid ""
"Information on {}:\n"
"{}"
msgstr ""
"Informations sur {}:\n"
"{}"
#: ../downloader.py:350
msgid "Missing from info.json"
msgstr "Informations manquantes de info.json"
#: ../downloader.py:359
msgid ""
"Command: {}\n"
"Made by: {}\n"
"Repo: {}\n"
"Cog name: {}"
msgstr ""
"Commande: {]\n"
"Créé par: {}\n"
"Repo: {}\n"
"Nom du cog: {}"
#: ../downloader.py:383
msgid "That command doesn't seem to exist."
msgstr "Cette commande ne semble pas exister"

View File

@@ -0,0 +1,93 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2017-08-26 17:05+EDT\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: pygettext.py 1.5\n"
#: ../downloader.py:202
msgid "That git repo has already been added under another name."
msgstr ""
#: ../downloader.py:204 ../downloader.py:205
msgid "Something went wrong during the cloning process."
msgstr ""
#: ../downloader.py:207
msgid "Repo `{}` successfully added."
msgstr ""
#: ../downloader.py:216
msgid "The repo `{}` has been deleted successfully."
msgstr ""
#: ../downloader.py:224
msgid ""
"Installed Repos:\n"
msgstr ""
#: ../downloader.py:244
msgid "Error, there is no cog by the name of `{}` in the `{}` repo."
msgstr ""
#: ../downloader.py:249
msgid "Failed to install the required libraries for `{}`: `{}`"
msgstr ""
#: ../downloader.py:259
msgid "`{}` cog successfully installed."
msgstr ""
#: ../downloader.py:275
msgid "`{}` was successfully removed."
msgstr ""
#: ../downloader.py:277
msgid "That cog was installed but can no longer be located. You may need to remove it's files manually if it is still usable."
msgstr ""
#: ../downloader.py:301
msgid "Cog update completed successfully."
msgstr ""
#: ../downloader.py:309
msgid ""
"Available Cogs:\n"
msgstr ""
#: ../downloader.py:321
msgid "There is no cog `{}` in the repo `{}`"
msgstr ""
#: ../downloader.py:326
msgid ""
"Information on {}:\n"
"{}"
msgstr ""
#: ../downloader.py:350
msgid "Missing from info.json"
msgstr ""
#: ../downloader.py:359
msgid ""
"Command: {}\n"
"Made by: {}\n"
"Repo: {}\n"
"Cog name: {}"
msgstr ""
#: ../downloader.py:383
msgid "That command doesn't seem to exist."
msgstr ""

View File

@@ -0,0 +1,93 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2017-08-26 16:24+EDT\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: pygettext.py 1.5\n"
#: ../downloader.py:202
msgid "That git repo has already been added under another name."
msgstr ""
#: ../downloader.py:204 ../downloader.py:205
msgid "Something went wrong during the cloning process."
msgstr ""
#: ../downloader.py:207
msgid "Repo `{}` successfully added."
msgstr ""
#: ../downloader.py:216
msgid "The repo `{}` has been deleted successfully."
msgstr ""
#: ../downloader.py:224
msgid ""
"Installed Repos:\n"
msgstr ""
#: ../downloader.py:244
msgid "Error, there is no cog by the name of `{}` in the `{}` repo."
msgstr ""
#: ../downloader.py:249
msgid "Failed to install the required libraries for `{}`: `{}`"
msgstr ""
#: ../downloader.py:259
msgid "`{}` cog successfully installed."
msgstr ""
#: ../downloader.py:275
msgid "`{}` was successfully removed."
msgstr ""
#: ../downloader.py:277
msgid "That cog was installed but can no longer be located. You may need to remove it's files manually if it is still usable."
msgstr ""
#: ../downloader.py:301
msgid "Cog update completed successfully."
msgstr ""
#: ../downloader.py:309
msgid ""
"Available Cogs:\n"
msgstr ""
#: ../downloader.py:321
msgid "There is no cog `{}` in the repo `{}`"
msgstr ""
#: ../downloader.py:326
msgid ""
"Information on {}:\n"
"{}"
msgstr ""
#: ../downloader.py:350
msgid "Missing from info.json"
msgstr ""
#: ../downloader.py:359
msgid ""
"Command: {}\n"
"Made by: {}\n"
"Repo: {}\n"
"Cog name: {}"
msgstr ""
#: ../downloader.py:383
msgid "That command doesn't seem to exist."
msgstr ""

View File

@@ -0,0 +1,94 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2017-08-26 16:35-0400\n"
"PO-Revision-Date: 2017-08-26 16:42-0400\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 1.8.7.1\n"
"Last-Translator: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: nl\n"
#: ../downloader.py:202
msgid "That git repo has already been added under another name."
msgstr ""
#: ../downloader.py:204 ../downloader.py:205
msgid "Something went wrong during the cloning process."
msgstr ""
#: ../downloader.py:207
msgid "Repo `{}` successfully added."
msgstr ""
#: ../downloader.py:216
msgid "The repo `{}` has been deleted successfully."
msgstr ""
#: ../downloader.py:224
msgid "Installed Repos:\n"
msgstr ""
#: ../downloader.py:244
msgid "Error, there is no cog by the name of `{}` in the `{}` repo."
msgstr ""
#: ../downloader.py:249
msgid "Failed to install the required libraries for `{}`: `{}`"
msgstr ""
#: ../downloader.py:259
msgid "`{}` cog successfully installed."
msgstr ""
#: ../downloader.py:275
msgid "`{}` was successfully removed."
msgstr ""
#: ../downloader.py:277
msgid ""
"That cog was installed but can no longer be located. You may need to remove "
"it's files manually if it is still usable."
msgstr ""
#: ../downloader.py:301
msgid "Cog update completed successfully."
msgstr ""
#: ../downloader.py:309
msgid "Available Cogs:\n"
msgstr ""
#: ../downloader.py:321
msgid "There is no cog `{}` in the repo `{}`"
msgstr ""
#: ../downloader.py:326
msgid ""
"Information on {}:\n"
"{}"
msgstr ""
#: ../downloader.py:350
msgid "Missing from info.json"
msgstr ""
#: ../downloader.py:359
msgid ""
"Command: {}\n"
"Made by: {}\n"
"Repo: {}\n"
"Cog name: {}"
msgstr ""
#: ../downloader.py:383
msgid "That command doesn't seem to exist."
msgstr ""

View File

@@ -447,7 +447,7 @@ class RepoManager:
self._repos = {}
loop = asyncio.get_event_loop()
loop.run_until_complete(self._load_repos(set=True)) # str_name: Repo
loop.create_task(self._load_repos(set=True)) # str_name: Repo
@property
def repos_folder(self) -> Path: