/** * Dictionary Interface - Keyword Translation * * Provides keyword translations between languages. * DSLs implement this to provide their domain-specific translations. */ /** * Dictionary provides keyword translations between languages. */ export interface Dictionary { /** * Look up canonical form from localized keyword. * * @param localizedWord - Word in target language (e.g., 'トグル', 'alternar') * @param language - Language code * @returns Canonical form (e.g., 'toggle') or undefined * * @example * dictionary.lookup('トグル', 'ja') // → 'toggle' * dictionary.lookup('alternar', 'es') // → 'toggle' */ lookup(localizedWord: string, language: string): string | undefined; /** * Translate canonical keyword to target language. * * @param canonical - Canonical form (e.g., 'toggle') * @param targetLanguage - Target language code * @returns Localized form or undefined * * @example * dictionary.translate('toggle', 'ja') // → 'トグル' * dictionary.translate('toggle', 'es') // → 'alternar' */ translate(canonical: string, targetLanguage: string): string | undefined; /** * Get all translations of a word across all supported languages. * * @param word - Word to translate * @param sourceLanguage - Source language * @returns Map of language code to translation * * @example * dictionary.getAllTranslations('toggle', 'en') * // → { ja: 'トグル', es: 'alternar', ko: '토글', ... } */ getAllTranslations(word: string, sourceLanguage: string): Record; /** * Optional: Find what category a word belongs to. * Useful for organizing translations by domain (commands, modifiers, events, etc.). */ getCategory?(word: string, language: string): string | undefined; } /** * Simple in-memory dictionary implementation. * Suitable for small DSLs or prototyping. */ export declare class InMemoryDictionary implements Dictionary { private translations; /** * @param translations - Map of language code to canonical→localized mappings * * @example * new InMemoryDictionary({ * en: { select: 'select', insert: 'insert' }, * es: { select: 'seleccionar', insert: 'insertar' }, * ja: { select: '選択', insert: '挿入' } * }) */ constructor(translations: Record>); lookup(word: string, language: string): string | undefined; translate(canonical: string, targetLanguage: string): string | undefined; getAllTranslations(word: string, sourceLanguage: string): Record; } /** * Null dictionary - no translations (useful for single-language DSLs). */ export declare class NullDictionary implements Dictionary { lookup(word: string, _language: string): string | undefined; translate(canonical: string, _targetLanguage: string): string | undefined; getAllTranslations(word: string, _sourceLanguage: string): Record; } //# sourceMappingURL=dictionary.d.ts.map