Can't set up localized commands

When I try to use the setNameLocalization or setDescriptionLocalization builders, I get this trace: https://sourceb.in/Mi21E9xgjR When I instead use setName() and setDescription(), everything works fine and I can deploy my commands. With localization: https://sourceb.in/XHryaBBlKW Without: https://sourceb.in/WPeFdrNZKf
19 Replies
d.js toolkit
d.js toolkit•3w ago
Mafia
Mafia•3w ago
you still need to setName and setDescription, they are required
d.js docs
d.js docs•3w ago
guide suggestion for @Myst: :guide: Localizations The names and descriptions of slash commands can be localized to the user's selected language. You can find the list of accepted locales on the discord API documentation. Setting localizations with setNameLocalizations() and setDescriptionLocalizations() takes the format of an object, mapping location codes (e.g. pl and de) to their localized strings. read more
Myst
MystOP•3w ago
@Mafia , oh, so I need both setName() AND setNameLocalization() for the same command?
Mafia
Mafia•3w ago
yes,
Myst
MystOP•3w ago
ooooh I thought there was a fallback to en-us, or the first in the list thanks a lot @Mafia
Mafia
Mafia•3w ago
np
Myst
MystOP•3w ago
(oh yeah but that would make things messy if the dev enters different locales for each property, I understand why we still need a non-localized version)
Mafia
Mafia•3w ago
are you using a table/object for the localizations?
Myst
MystOP•3w ago
I'm using a mess of a system I just cooked up from an object like this one: https://sourceb.in/kuPdb6DcBd
Mafia
Mafia•3w ago
for example
const local = {
"en-US": "name"
}
command.setNameLocalizations(local)
const local = {
"en-US": "name"
}
command.setNameLocalizations(local)
Myst
MystOP•3w ago
in order not to declare N items for each locale yep in the end I'm able to have .setNameLocalizations(getLocProps(strings.commands.mjg.nanikiru.desc)) even if I have 10 localization objects
Mafia
Mafia•3w ago
so then do
command.setName(local["en-US"])
command.setName(local["en-US"])
Myst
MystOP•3w ago
yep
Mafia
Mafia•3w ago
So then this is not an issue?
Myst
MystOP•3w ago
no it's not, I just failed to see the need for this apparent redundancy 🙂
Mafia
Mafia•3w ago
Discord needs a fallback also name is how command interactions are idenified. so you as a dev would want a consitant name
Myst
MystOP•3w ago
oh okay, the localizedName is just sugar on top of the actual one
Mafia
Mafia•3w ago
correct. it is for user interface only

Did you find this page helpful?