Cannot access localizations

I implemented the help command as follows, but I am having trouble getting Japanese from localizations
Does anyone know the correct way to do this?
    async execute(interaction) {
        const { client } = interaction;
        let commands = await client.application.commands.fetch();

        if (interaction.guild) {
            const guildCommands = await interaction.guild.commands.fetch();
            commands = new Map([...commands, ...guildCommands]);
        }

        const userLocale = interaction.locale;
        const isJapanese = userLocale === 'ja'; // Confirmed to be "true"

        const embed = new EmbedBuilder()
            .setColor('#0099ff')
            .setTitle(isJapanese ? '利用可能なコマンド' : 'Available Commands')
            .setDescription(isJapanese ? '以下は現在利用可能なコマンドのリストです' : 'Here is a list of currently available commands');

        commands.forEach(command => {
            if (command.name !== 'help') {
                let description = command.description || (isJapanese ? '説明なし' : 'No description');
                if (isJapanese && command?.descriptionLocalizations?.['ja']) { // Can't get through.
                    description = command.descriptionLocalizations['ja'];
                }
                embed.addFields({
                    name: `</${command.name}:${command.id}>`,
                    value: description,
                    inline: true
                });
            }
        });
        embed.setFooter({
            text: isJapanese
                ? '注意: 一部のコマンドは特定のサーバーまたはユーザーインストールでのみ使用できます。'
                : 'Note: Some commands may only be available in specific servers or user installations.'
        });
        await interaction.reply({ embeds: [embed], ephemeral: true });
    },
};


[example command]
module.exports = {
    global: true,
    data: new SlashCommandBuilder()
        .setName('search')
        .setIntegrationTypes(ApplicationIntegrationType.GuildInstall, ApplicationIntegrationType.UserInstall)
        .setContexts(InteractionContextType.Guild, InteractionContextType.BotDM, InteractionContextType.PrivateChannel)
        .setDescription('Searches for elements by the specified search character')
        .setDescriptionLocalizations({
            'ja': '指定した検索文字で要素を検索します'
        })
...


Thanks for your help.
Was this page helpful?