🌎Traslations

To support multilingualism, you can use the built-in translation system described in the previous section. In the strings folder you need to create YAML files with the language code as the name, for example ru.yaml or en.yaml. After loading the module, the attribute of class S will contain the current language selected on the basis of the bot's config, or, if it is not found, the fallback language (also specified in the config). If it is not found, the first one is chosen. At any time, the current language can be obtained in the cur_lang attribute, and all loaded translations in rawS.

text = self.S["help"]["header"]

Usage example

Last updated