Hierarchy (View Summary)

Constructors

Properties

apiExtra?: unknown
apiKey?: string
apiUrl: string
apiUrlPlaceholder: string = "https://translate.yandex.net/api/v1/tr.json"
baseLang: string = config.baseLang
fetchOpts: Record<string, unknown>
headers: { "Content-Type": string; "User-Agent": string } = ...
MAX_UID: number = ...
NANO_DIFF: number = 1000000
origin: string
originPlaceholder: string = "https://translate.yandex.ru"
sessionUrl: string = "https://translate.yandex.ru/props/api/v1.0"

Methods

  • Parameters

    • body: null | URLSearchParams
    • headers: Record<string, string> = {}
    • method: RequestMethod = "POST"

    Returns {
        body: null | URLSearchParams;
        headers: {
            "Content-Type": string;
            Origin: string;
            Referer: string;
            "User-Agent": string;
        };
        method: RequestMethod;
    }

  • You can use this method if you need a probabilities

    Parameters

    • text: string
    • options: DetectOptions = DetectOptions.withCurrentProb

    Returns Promise<{ lang: string; probs: Record<string, number>; score: number }>

  • You can use this method if you need a detected language or align

    Parameters

    • text: string | string[]
    • lang: string = "en-ru"
    • options: TranslateOptions = TranslateOptions.default
    • format: "text" | "html" = "text"

    Returns Promise<
        {
            align: undefined
            | string[];
            detected: undefined | Record<"lang", string>;
            lang: `${string}-${string}`;
            translations: string[];
        },
    >