UNPKG

@memory-bank/mcp

Version:

Memory-enabled Co-Pilot (MCP) server for managing project documentation and context

97 lines 3.23 kB
/** * I18n Service * * Application service for handling internationalization and translations. * Manages current language context and provides translation functionality. */ import { Language, LanguageCode } from '../../domain/i18n/Language.js'; import { II18nRepository } from '../../domain/i18n/II18nRepository.js'; import { Translation } from '../../domain/i18n/Translation.js'; /** * Service for handling internationalization and translations */ export declare class I18nService { private repository; private currentLanguage; /** * Constructor * * @param repository Repository for accessing translations */ constructor(repository: II18nRepository); /** * Gets the current language * * @returns Current language */ getCurrentLanguage(): Language; /** * Sets the current language * * @param languageCode Language code to set as current * @throws Error if language code is not supported */ setCurrentLanguage(languageCode: LanguageCode): void; private translationCache; private isTranslationLoaded; /** * Load all translations into memory for faster access * * @returns Promise resolving when all translations are loaded */ loadAllTranslations(): Promise<void>; /** * Translates a key to the specified language or current language * Method overloads for both synchronous and asynchronous usage */ /** * Synchronous version that uses the cache and specified language code * Must call loadAllTranslations() first to populate the cache * * @param key Translation key * @param languageCode Language code to translate to */ translate(key: string, languageCode: string): string; /** * Asynchronous version that translates to the current language * * @param key Translation key * @param variables Optional variables for replacement */ translate(key: string, variables?: Record<string, string>): Promise<string>; /** * Gets all supported languages * * @returns Promise resolving to array of supported languages */ getSupportedLanguages(): Promise<Language[]>; /** * Checks if a translation exists for current language * * @param key Translation key * @returns Promise resolving to boolean indicating if translation exists */ hasTranslation(key: string): Promise<boolean>; /** * Gets all available translation keys * * @returns Promise resolving to array of translation keys */ getAllKeys(): Promise<string[]>; /** * Gets all translations for the current language * * @returns Promise resolving to array of translations */ getAllTranslationsForCurrentLanguage(): Promise<Translation[]>; /** * Saves a translation * * @param key Translation key * @param text Translated text * @param languageCode Optional language code (defaults to current language) * @returns Promise resolving to boolean indicating success */ saveTranslation(key: string, text: string, languageCode?: LanguageCode): Promise<boolean>; } //# sourceMappingURL=I18nService.d.ts.map