Skip to content

Localizing application commands

The framework allows you to localize your commands, options and choices.

This is based on JDA's LocalizationFunction, see the documentation on how keys are composed.

Registering bundles

You'll have to provide the name(s) and supported locales to BApplicationConfigBuilder.addLocalizations. If a bundle does not support locales, it can still be used for default descriptions.

Default descriptions

Commands and options can have their descriptions retrieved from "root" bundles, essentially this lets you move the descriptions from your code into the bundles.

Examples

src/main/resources/bc_localization/Commands.json
{
    "search.description": "Searches the docs"
}

This way you don't need to set the description on @JDASlashCommand(name = "search").

src/main/resources/bc_localization/Commands_fr_FR.json
{
    "tags.edit": {
        "name": "rechercher",
        "description": "Rechercher la documentation",
        "options": {
            "query": {
                "name": "requête",
                "description": "La requête à rechercher"
            }
        }
    }
}