Skip to content

05. Language Support

engels74 edited this page Oct 19, 2024 · 1 revision

🌐 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.

πŸ—£οΈ Currently Supported Languages

As of the latest version, TGraph Bot supports the following languages:

  • English (en)
  • Danish (da)

πŸ”„ Changing the Bot's Language

To change the language of TGraph Bot:

  1. Open your config.yml file.
  2. Find the LANGUAGE setting.
  3. Set it to the ISO 639-1 language code you want to use. For example:
    LANGUAGE: en  # For English
    or
    LANGUAGE: da  # For Danish
  4. Save the config.yml file and restart the bot for the changes to take effect.

🧩 What Gets Translated?

The language setting affects various aspects of the bot's output, including:

  • Command responses
  • Graph titles and labels
  • Error messages
  • Log messages

πŸ“ Translation Files

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.

πŸ†• Adding a New Language

If you'd like to add support for a new language:

  1. Create a new YAML file in the i18n directory, named with the appropriate ISO 639-1 language code (e.g., fr.yml for French).
  2. Copy the contents of en.yml into your new file.
  3. Translate all the values in the new file, keeping the keys the same.
  4. Submit a pull request to the TGraph Bot repository with your new translation file.

πŸ” Example Translation Entry

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)"

πŸ› Reporting Translation Issues

If you notice any issues with existing translations:

  1. Check the current translation files in the i18n directory of the source code.
  2. 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.

🀝 Contributing Translations

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:

  1. Fork the TGraph Bot repository.
  2. 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
  3. Add or edit the appropriate YAML file in the i18n directory.
  4. Commit your changes and push to your fork.
  5. Submit a pull request with your changes.

Your contribution will help make TGraph Bot accessible to more users around the world!