feat: Support for multiple translation services in tranbox

This commit is contained in:
Gabe
2025-10-02 11:33:33 +08:00
parent 039566ded5
commit 389f0b6f82
9 changed files with 41 additions and 36 deletions

View File

@@ -849,14 +849,9 @@ export class Translator {
// 提前进行语言检测
let deLang = "";
const { fromLang = "auto", toLang } = this.#rule;
const { detectRemote, skipLangs = [] } = this.#setting;
const { langDetector, skipLangs = [] } = this.#setting;
if (fromLang === "auto") {
const { langDetector } = this.#setting;
deLang = await tryDetectLang(
node.textContent,
detectRemote,
langDetector
);
deLang = await tryDetectLang(node.textContent, langDetector);
if (
deLang &&
(toLang.slice(0, 2) === deLang.slice(0, 2) ||