This document is for Red's development version, which can be significantly different from previous releases. If you're a regular user, you should read the Red documentation for the current stable release.

Internationalization Framework

Basic Usage

from redbot.core import commands
from redbot.core.i18n import Translator, cog_i18n

_ = Translator("ExampleCog", __file__)

class ExampleCog:

    async def mycom(self, ctx):
        """command description"""
        await ctx.send(_("This is a test command"))


After making your cog, generate a messages.pot file

We recommend using redgettext - a modified version of pygettext for Red. You can install redgettext by running pip install redgettext in a command prompt.

To generate the messages.pot file, you will now need to run python -m redgettext -c [path_to_cog] This file will contain all strings to be translated, including docstrings. (For advanced usage check python -m redgettext -h)

You can now use a tool like poedit to translate the strings in your messages.pot file.

API Reference

class redbot.core.i18n.Translator(*args, **kwds)[source]

Bases: collections.abc.Callable, typing.Generic

Function to get translated strings at runtime.


Translate the given string.

This will look for the string in the translator’s .pot file, with respect to the current locale.


Loads the current translations.


Get a class decorator to link the translator to this cog.


Function to convert a locale to a babel.core.Locale.


locale (Optional[str]) – The locale to convert, if not specified it defaults to the bot’s locale.


The babel locale object.

Return type



Function to convert a regional format to a babel.core.Locale.

If regional_format parameter is passed, this behaves the same as get_babel_locale.


regional_format (Optional[str]) – The regional format to convert, if not specified it defaults to the bot’s regional format.


The babel locale object.

Return type