export interface TranslationData { [key: string]: string | TranslationData; } export interface LanguageConfig { code: string; name: string; flag?: string; rtl?: boolean; } export interface LanguageSwitcherOptions { defaultLanguage: string; fallbackLanguage?: string; persistLanguage?: boolean; storageKey?: string; onLanguageChange?: (_language: string) => void; debug?: boolean; autoTranslate?: boolean; translationApi?: TranslationApiConfig; contentSelectors?: string[]; excludeSelectors?: string[]; preserveOriginalText?: boolean; } export interface TranslationApiConfig { provider: 'deepl' | 'google-cloud' | 'custom'; apiKey?: string; endpoint?: string; region?: string; model?: string; batchSize?: number; rateLimit?: number; } export interface DetectedContent { element: HTMLElement; originalText: string; translatedText?: string; language: string; isTranslated: boolean; timestamp: number; } export interface TranslationRequest { text: string; fromLanguage: string; toLanguage: string; context?: string; element?: HTMLElement; } export interface TranslationResponse { translatedText: string; confidence?: number; detectedLanguage?: string; alternatives?: string[]; } export interface ContentDetector { detect(): DetectedContent[]; watch(_callback: (_content: DetectedContent[]) => void): void; unwatch(): void; } export interface TranslationService { translate(_request: TranslationRequest): Promise; translateBatch(_requests: TranslationRequest[]): Promise; detectLanguage(_text: string): Promise; } export interface LanguageSwitcherInstance { currentLanguage: string; availableLanguages: LanguageConfig[]; translations: Record; setLanguage(_language: string): Promise; getText(_key: string, _params?: Record): string; addLanguage(_language: string, _config: LanguageConfig): void; addTranslations(_language: string, _translations: TranslationData): void; removeLanguage(_language: string): void; isRTL(): boolean; getLanguageConfig(_language: string): LanguageConfig | undefined; startAutoTranslation(): void; stopAutoTranslation(): void; translatePage(_targetLanguage?: string): Promise; translateElement(_element: HTMLElement, _targetLanguage?: string): Promise; restoreOriginalText(): void; getDetectedContent(): DetectedContent[]; setTranslationApi(_config: TranslationApiConfig): void; } export type InterpolationFunction = (_key: string, _params: Record) => string;