Translation API

This page assumes you’ve completed Creating a Simple Hello World Module. If not, check the previous pages.

If you want your modules to be translate-able, you can use the Translation API.

Translation Files

Translation files use the HOCON syntax. They don’t have any standard directory, however it’s recommended to keep them inside the module directory somewhere since they will most likely be non-editable.

Registering Languages

Before doing anything, you’ll need to register your language files using register_language:

async def on_ready(self):
    module_dir = os.path.dirname(os.path.abspath(__file__))

    # self.lang is the Translation instance of all modules.
        Configuration(os.path.join(module_dir, "en.conf")),

        Configuration(os.path.join(module_dir, "tr.conf")),

Getting Translated Text

To get translated text, we use get:

async def run(self, message: discord.Message, **kwargs):
    name = kwargs.get(
        self.module.lang.get(, "default_name")

    # text == "Hello, {name}"
    # The last dict contains format variables.
    text = self.module.lang.get(, "text", {"name": name})

    await self.client.send_message(, text)

And that’s about it for translation. The same module (with some comments) can be found on our examples repository