-
Notifications
You must be signed in to change notification settings - Fork 0
05. Language Support
TGraph Bot supports multiple languages, allowing you to use the bot in your preferred language. This page explains how to use and contribute to the bot's language support features.
As of the latest version, TGraph Bot supports the following languages:
- English (en)
- Danish (da)
To change the language of TGraph Bot:
- Open your
config.yml
file. - Find the
LANGUAGE
setting. - Set it to the ISO 639-1 language code you want to use. For example:
or
LANGUAGE: en # For English
LANGUAGE: da # For Danish
- Save the
config.yml
file and restart the bot for the changes to take effect.
The language setting affects various aspects of the bot's output, including:
- Command responses
- Graph titles and labels
- Error messages
- Log messages
Translations are managed through YAML files located in the i18n
directory of the bot's source code. Each language has its own file:
-
en.yml
for English -
da.yml
for Danish
These files contain key-value pairs for all the translatable strings used by the bot.
If you'd like to add support for a new language:
- Create a new YAML file in the
i18n
directory, named with the appropriate ISO 639-1 language code (e.g.,fr.yml
for French). - Copy the contents of
en.yml
into your new file. - Translate all the values in the new file, keeping the keys the same.
- Submit a pull request to the TGraph Bot repository with your new translation file.
Here's an example of how a translation entry looks in the YAML file:
daily_play_count_title: "Daily Play Count by Media Type (Last {days} days)"
In a translation file for another language, you would translate the value while keeping the key and any placeholders (like {days}
) the same:
daily_play_count_title: "TΓ€gliche Wiedergabezahl nach Medientyp (Letzte {days} Tage)"
If you notice any issues with existing translations:
- Check the current translation files in the
i18n
directory of the source code. - If you find an error, you can either:
- Submit an issue on the GitHub repository describing the problem.
- Submit a pull request with the corrected translation.
Contributions to improve existing translations or add new languages are always welcome! If you're fluent in a language not currently supported by TGraph Bot, consider contributing a translation. Here's how:
- Fork the TGraph Bot repository.
- Create a new branch for your translation work. Use the naming convention
i18n-languageCode
. For example:-
i18n-fr
for French -
i18n-es
for Spanish -
i18n-de
for German
-
- Add or edit the appropriate YAML file in the
i18n
directory. - Commit your changes and push to your fork.
- Submit a pull request with your changes.
Your contribution will help make TGraph Bot accessible to more users around the world!