71 lines
2.8 KiB
TypeScript
71 lines
2.8 KiB
TypeScript
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
|
// This file is automatically generated. DO NOT EDIT
|
|
|
|
/**
|
|
* TranslationService 翻译服务
|
|
* @module
|
|
*/
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore: Unused imports
|
|
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore: Unused imports
|
|
import * as translator$0 from "../common/translator/models.js";
|
|
|
|
/**
|
|
* GetTranslatorLanguages 获取翻译器的语言列表
|
|
* @param {string} translatorType - 翻译器类型 ("google", "bing", "youdao", "deepl")
|
|
* @returns {map[string]string} 语言代码到名称的映射
|
|
* @returns {error} 可能的错误
|
|
*/
|
|
export function GetTranslatorLanguages(translatorType: translator$0.TranslatorType): Promise<{ [_: string]: translator$0.LanguageInfo }> & { cancel(): void } {
|
|
let $resultPromise = $Call.ByID(3976114458, translatorType) as any;
|
|
let $typingPromise = $resultPromise.then(($result: any) => {
|
|
return $$createType1($result);
|
|
}) as any;
|
|
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
|
return $typingPromise;
|
|
}
|
|
|
|
/**
|
|
* GetTranslators 获取所有可用翻译器类型
|
|
* @returns {[]string} 翻译器类型列表
|
|
*/
|
|
export function GetTranslators(): Promise<string[]> & { cancel(): void } {
|
|
let $resultPromise = $Call.ByID(3720069432) as any;
|
|
let $typingPromise = $resultPromise.then(($result: any) => {
|
|
return $$createType2($result);
|
|
}) as any;
|
|
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
|
return $typingPromise;
|
|
}
|
|
|
|
/**
|
|
* IsLanguageSupported 检查指定的语言代码是否受支持
|
|
*/
|
|
export function IsLanguageSupported(translatorType: translator$0.TranslatorType, languageCode: string): Promise<boolean> & { cancel(): void } {
|
|
let $resultPromise = $Call.ByID(2819945417, translatorType, languageCode) as any;
|
|
return $resultPromise;
|
|
}
|
|
|
|
/**
|
|
* TranslateWith 使用指定翻译器进行翻译
|
|
* @param {string} text - 待翻译文本
|
|
* @param {string} from - 源语言代码 (如 "en", "zh", "auto")
|
|
* @param {string} to - 目标语言代码 (如 "en", "zh")
|
|
* @param {string} translatorType - 翻译器类型 ("google", "bing", "youdao", "deepl")
|
|
* @returns {string} 翻译后的文本
|
|
* @returns {error} 可能的错误
|
|
*/
|
|
export function TranslateWith(text: string, $from: string, to: string, translatorType: string): Promise<string> & { cancel(): void } {
|
|
let $resultPromise = $Call.ByID(3577923623, text, $from, to, translatorType) as any;
|
|
return $resultPromise;
|
|
}
|
|
|
|
// Private type creation functions
|
|
const $$createType0 = translator$0.LanguageInfo.createFrom;
|
|
const $$createType1 = $Create.Map($Create.Any, $$createType0);
|
|
const $$createType2 = $Create.Array($Create.Any);
|