Localization
JDA uses the LocalizationFunction for localizing slash commands.
We implement this interface based on MessageResolver (see the localization wiki for details).
If you want to disable command localization just call JDACBuilder#localizeCommands(false).
The bundle used is generally default.
If the interaction controller class or the package-info.java in the same package as the class
is annotated by @Bundle, the specified bundle will be used instead. If the localization key isn't found in this bundle, the default
bundle will be searched as a fallback option.
Example
main/Greet.java
@Bundle("greet")
@Interaction
public class Greet {
@Command("greet user")
public void onCommand(CommandEvent event, Member member) {
event.reply("Hello World %s!".formatted(member.getAsMention()));
}
}
See the JDA Docs for more details about the localization keys and locales.
(We use DiscordLocale#toLocale() to convert the locales).