anylang
Version:
A translator's kit that uses the free APIs of Google Translate, Yandex, Bing, ChatGPT, and other LLMs
25 lines (24 loc) • 990 B
TypeScript
import { BaseTranslator } from './BaseTranslator';
/**
* Fake translator for use in tests and debug
*/
export declare class FakeTranslator extends BaseTranslator<{
delay?: number | 'random';
}> {
static readonly translatorName = "FakeTranslator";
static isSupportedAutoFrom(): boolean;
static getSupportedLanguages(): string[];
getLengthLimit(): number;
getRequestsTimeout(): number;
checkDirection(from: string, to: string): boolean;
translate(text: string, from: string, to: string): Promise<string>;
translateBatch(text: string[], from: string, to: string): Promise<(string | null)[]>;
}
/**
* Fake translator which always throw error for use in tests and debug
*/
export declare class ErrorFakeTranslator extends FakeTranslator {
static readonly translatorName = "FakeTranslator";
translate(_text: string, _from: string, _to: string): Promise<string>;
translateBatch(_text: string[], _from: string, _to: string): Promise<string[]>;
}