detect lang remote

This commit is contained in:
Gabe Yuan
2023-10-11 10:27:51 +08:00
parent dd99fddc07
commit 791ec65579
5 changed files with 35 additions and 2 deletions

View File

@@ -363,6 +363,7 @@ export class Translator {
const apiSetting = (this._setting.transApis || DEFAULT_TRANS_APIS)[
translator
];
const { detectRemote } = this._setting;
let triggerShortcut = initTriggerShortcut;
let triggerCount = initTriggerCount;
@@ -421,7 +422,7 @@ export class Translator {
try {
addLoading(node, loadingId);
const deLang = await tryDetectLang(text, true);
const deLang = await tryDetectLang(text, detectRemote);
if (deLang && toLang.includes(deLang)) {
return;
}