Skip to content
This repository has been archived by the owner on Dec 24, 2021. It is now read-only.

Localisation #197

Open
Gawdl3y opened this issue Sep 26, 2018 · 5 comments
Open

Localisation #197

Gawdl3y opened this issue Sep 26, 2018 · 5 comments
Milestone

Comments

@Gawdl3y
Copy link
Member

Gawdl3y commented Sep 26, 2018

A system needs to be added to allow all built-in text to be translated to other languages or customised for any other reason. This system should also be usable by non-built-in components, allowing for easier translation of bots. The current locale should be a guild-specific setting, and locales should implement the Loader/Loadable functionality (depends on #196).

@perzeuss
Copy link

As promised, I'm working on that issue and have made some design decisions:

  • I use https://github.com/i18next as it already has a Loader/Loadable system and is feature rich, however it will be possible to integrate our own loader system later on. Bot owners may load and afterwards reload localization files even the ones which did not exist on initialization time.

  • I18next can be used for the whole bot, not only for commando. However, it will be possible to create a whole new instance, so there are no conflicts between commando translations and other ones.

  • Commando uses the language dev for its builtin strings, so one can define own strings for en, fallback language will be dev.

  • Language can be set same as the prefix, means global and per guild which will override the global one for messages on that guild.

  • The bot can't use the guild.language in DM mode so commando will try to translate into the language defined by user.locale but that may be different than guild.language. It's possible to configure fallback language for each user.locale (see https://www.i18next.com/principles/fallback) so when user.locale equals es it's possible to fallback to fr instead of using the builtin translation.

  • The property used for the global language is named defaultLanguage and for guilds language, e.g. client.defaultLanguage and msg.guild.language.

  • Commandos builtin strings are defined in a javascript object instead of a json file. so one does not need to setup a path with localization files.

  • No breaking changes - it will be possible to start commando without additional setup/configuration required, so there are no breaking changes.

  • Use without translation - one can choose to define strings as normal, or use translations. Both variants will work. Also it will be possible to translate only selected strings into another languages. For the others, the default strings will be used.
    example: description: new CommandoTranslatable('command.help.description') will work and translates the description description: 'my hard coded description' will also work, of course without translation

@perzeuss
Copy link

Update: I'm almost done. I've implemented the feature on my private bot and everything seems to work.
Only the translations for the type validations are missing.

perzeuss added a commit to respawn-network/Commando that referenced this issue Aug 20, 2020
perzeuss added a commit to respawn-network/Commando that referenced this issue Feb 17, 2021
@Torbraw
Copy link

Torbraw commented Mar 12, 2021

Any news when this will be implemented officially?
Thanks

@Kaon68
Copy link

Kaon68 commented Jun 4, 2021

@perzeuss : 10 months later, is it still "almost done" ? Something can be done to help you achieve this ?
What is the roadmap to merge this into an official release (with documentation ^^) ?

thx :)

@perzeuss
Copy link

perzeuss commented Jun 4, 2021

@Torbraw @Kaon68 Please look at the PR for this issue: #324 (comment)

@Gawdl3y did not like my solution and I started to rewrite it but I had not time yet to complete that rewrite, because I've other work to do with higher priority.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

No branches or pull requests

4 participants