mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
fix integer options not being translated
This commit is contained in:
1 parent
fcf725fa4c
commit
b15045bbdd
1 file changed
+6
-1
@@ -122,6 +122,7 @@ export function localizeCommand(command: Omit<SlashCommandBuilder, 'addSubcomman
|
|||||||
const localeOptionData = (
|
const localeOptionData = (
|
||||||
translatorInstance.getResource(locale, 'bot', metadataKey) as CommandMetadata | undefined
|
translatorInstance.getResource(locale, 'bot', metadataKey) as CommandMetadata | undefined
|
||||||
)?.options?.[option.name];
|
)?.options?.[option.name];
|
||||||
|
|
||||||
if (locale.startsWith('en') || !localeOptionData) {
|
if (locale.startsWith('en') || !localeOptionData) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -131,7 +132,11 @@ export function localizeCommand(command: Omit<SlashCommandBuilder, 'addSubcomman
|
|||||||
if (localeOptionData.description) {
|
if (localeOptionData.description) {
|
||||||
option.description_localizations[locale] = localeOptionData.description;
|
option.description_localizations[locale] = localeOptionData.description;
|
||||||
}
|
}
|
||||||
if (localeOptionData.choices && option.type === ApplicationCommandOptionType.String && option.choices) {
|
if (
|
||||||
|
localeOptionData.choices &&
|
||||||
|
option.type === (ApplicationCommandOptionType.String || ApplicationCommandOptionType.Integer) &&
|
||||||
|
option.choices
|
||||||
|
) {
|
||||||
for (const choice of option.choices) {
|
for (const choice of option.choices) {
|
||||||
const localizedChoice = localeOptionData.choices[choice.value];
|
const localizedChoice = localeOptionData.choices[choice.value];
|
||||||
if (!localizedChoice) {
|
if (!localizedChoice) {
|
||||||
|
|||||||
Reference in new issue
Block a user