UNPKG

anylang

Version:

A translator's kit that uses the free APIs of Google Translate, Yandex, Bing, ChatGPT, and other LLMs

28 lines (27 loc) 1.17 kB
import { BaseTranslator } from '../BaseTranslator'; /** * Common class for google translator implementations */ export declare abstract class AbstractGoogleTranslator extends BaseTranslator { static isSupportedAutoFrom(): boolean; static getSupportedLanguages(): string[]; getLengthLimit(): number; getRequestsTimeout(): number; } /** * Translator implementation which use Google API with token from https://translate.google.com */ export declare class GoogleTranslator extends AbstractGoogleTranslator { static readonly translatorName = "GoogleTranslator"; checkLimitExceeding(text: string | string[]): number; translate(text: string, from: string, to: string): Promise<string>; translateBatch(text: string[], from: string, to: string): Promise<string[]>; } /** * Translator implementation which use Google API without token */ export declare class GoogleTranslatorTokenFree extends AbstractGoogleTranslator { static readonly translatorName = "GoogleTranslatorTokenFree"; translate: (text: string, from: string, to: string) => Promise<string>; translateBatch(text: string[], from: string, to: string): Promise<string[]>; }