Localizations for slash commands working partially

I'm trying to utilize i18next-plugin for registering slash commands using Discord's localization, but it doesn't seem to work properly. Command names/descriptions and option names are still English (the default, non-localized values) while my client language is Russian. Everything else is localized correctly. Here is my code:
new SlashCommandBuilder()
.setName(this.name)
.setNameLocalizations(allLocales("commands/buy:name"))
.setDescription(await english("commands/buy:description"))
.setDescriptionLocalizations(allLocales("commands/buy:description"))
.addStringOption(
new SlashCommandStringOption()
.setName(await english("commands/buy:options_item"))
.setDescription(await english("commands/buy:options_item_desc"))
.setDescriptionLocalizations(allLocales("commands/buy:options_item_desc"))
new SlashCommandBuilder()
.setName(this.name)
.setNameLocalizations(allLocales("commands/buy:name"))
.setDescription(await english("commands/buy:description"))
.setDescriptionLocalizations(allLocales("commands/buy:description"))
.addStringOption(
new SlashCommandStringOption()
.setName(await english("commands/buy:options_item"))
.setDescription(await english("commands/buy:options_item_desc"))
.setDescriptionLocalizations(allLocales("commands/buy:options_item_desc"))
I'm not sure if this is a Sapphire issue, Discord.js issue, or Discord issue. allLocales is a wrapper around i18next, for the name it returns { 'en-US': 'buy', ru: 'купить' }, for other values similar things.
4 Replies
Favna
Favna3y ago
the plugin exposes methods that can (read: should to make it easy on yourself) be used for translations: https://www.sapphirejs.dev/docs/Documentation/api-plugins/modules/i18next_src#applylocalizedbuilder. For an example of usages click through to the source code or import it and peek the IntelliSense. Granted I've never actually tried them with @Dragonite but we use the same methods for @Iriss and @Nekokai in the HTTP framework (it also uses the same i18next backend loader, sapphire pieces, and discordjs builders) and it works there.
Favna
Favna3y ago
.
.OP3y ago
Hm, interesting, will try! Although I still don't understand why my solution won't work.
Favna
Favna3y ago
Tbh neither do I but without actually trying the sapphire code myself I can't add much to that conversation.
Want results from more Discord servers?
Add your server