import { commandLocales, type CommandLocaleKey } from './command-locales.js'; export function commandLocale(key: CommandLocaleKey): { description: string; descriptionLocalizations: Record; } { const entry = commandLocales[key]; return { description: entry.en, descriptionLocalizations: { de: entry.de, 'en-US': entry.en } }; } export function localizedChoice(key: CommandLocaleKey, value: string) { const entry = commandLocales[key]; return { name: entry.en, name_localizations: { de: entry.de, 'en-US': entry.en }, value }; } export function applyCommandDescription< T extends { setDescription: (description: string) => T; setDescriptionLocalizations: (localizations: Record) => T; } >(builder: T, key: CommandLocaleKey): T { const locale = commandLocale(key); return builder .setDescription(locale.description) .setDescriptionLocalizations(locale.descriptionLocalizations); } export function applyOptionDescription< T extends { setDescription: (description: string) => T; setDescriptionLocalizations: (localizations: Record) => T; } >(option: T, key: CommandLocaleKey): T { return applyCommandDescription(option, key); }