import { Fetcher } from '../utils/Fetcher'; import { langCode, langCodeWithAuto, TranslatorInstanceMembers } from './Translator'; export type TranslatorOptions = {}> = O & { /** * API endpoint URL */ apiHost?: string; /** * Access key for requests to translator API */ apiKey?: string; /** * Union text array to 1 request (or more, but less than usualy anyway). * * Option for reduce the number of requests, but it can make artefacts in translated text. * * Some modules may not support this feature. */ useMultiplexing?: boolean; /** * Additional headers for requests */ headers?: Record; /** * Custom fetcher */ fetcher?: Fetcher; }; /** * Basic abstract class for translator */ export declare abstract class BaseTranslator = {}> implements TranslatorInstanceMembers { static readonly translatorName: string; static isRequiredKey: () => boolean; static isSupportedAutoFrom: () => boolean; static getSupportedLanguages: () => langCode[]; abstract getLengthLimit(): number; abstract getRequestsTimeout(): number; protected readonly options: TranslatorOptions; constructor(options?: TranslatorOptions); abstract translate(text: string, langFrom: langCodeWithAuto, langTo: langCode): Promise; abstract translateBatch(text: string[], langFrom: langCodeWithAuto, langTo: langCode): Promise<(string | null)[]>; checkLimitExceeding(text: string | string[]): number; protected fetch: Fetcher; }