@zhengxs/wechaty-plugin-assistant
Version:
52 lines (50 loc) • 1.35 kB
TypeScript
import { Translation, TranslationResult } from './translation';
export type DeepLTranslationOptions = {
from?: string;
to?: string;
};
export declare class DeepL extends Translation {
protected request(text: string, from: string, to: string): Promise<TranslationResult>;
random(): number;
timestamp(text: string): number;
}
export declare namespace DeepL {
type TranslationPartialText = {
text: string;
requestAlternatives: number;
};
type TranslationParameters = {
texts: TranslationPartialText[];
splitting: string;
lang: {
source_lang_user_selected: string;
target_lang: string;
};
timestamp: number;
};
type TranslationRequest = {
id: number;
jsonrpc: string;
method: string;
params: TranslationParameters;
};
type ResultAlternativeText = {
text: string;
};
type ResultText = {
text: string;
alternatives: ResultAlternativeText[];
};
type TranslationResult = {
texts: ResultText[];
lang: string;
lang_is_confident: boolean;
detectedLanguages: Record<string, number>;
};
type TranslationResponse = {
id: number;
jsonrpc: string;
result: TranslationResult;
};
}
export default DeepL;