-
Notifications
You must be signed in to change notification settings - Fork 33
Choose your language
This module supports multiple languages by default!
But you can also choose to use a custom language file or provide your messages programmatically (v3+ only).
Thanks to the amazing community, the module supports more and more languages by default.
You can use them by setting configuration key language with the name of a file. List of available files is available here:
https://github.com/utarwyn/discord-tictactoe/tree/next/config/locales
Usage example:
{
"language": "fr"
}You can also use file: in the configuration value language to provide an external locale file with custom messages.
Usage example:
{
"language": "file:/home/dev/my/language/file.json"
}Check english language file, copy its content and create a file by translating values based on your needs.
๐ Help me to make the module international by creating a PR with your language file! Thank you.
The module exposes a method to register message providers which can contain dynamic values to suit your needs.
You can add one provider per locale key and variables using curly brackets are still replaced in your messages.
You can use it this way:
const bot = new TicTacToe({ language: 'en' });
bot.addMessageProvider('game.title', () => 'Current date is ' + new Date());
bot.login('MY_TOKEN').then(() => console.log('Bot is loaded'));