feat: move 'remote detect' from rule to setting

This commit is contained in:
Gabe
2025-09-30 01:38:07 +08:00
parent 20c4d6f6eb
commit b60b770ed6
8 changed files with 62 additions and 63 deletions

View File

@@ -1033,6 +1033,11 @@ export const I18N = {
en: `After enabling, the detection accuracy will increase, but it will reduce the translation speed. Please enable it as appropriate.`,
zh_TW: `啟用後可提升偵測準確度,但會降低翻譯速度,請視需要開啟。`,
},
detect_lang_service: {
zh: `语言检测服务`,
en: `Language detect service`,
zh_TW: `語言檢測服務`,
},
disable: {
zh: `禁用`,
en: `Disable`,

View File

@@ -96,8 +96,8 @@ export const DEFAULT_RULE = {
transTag: GLOBAL_KEY, // 译文元素标签
transTitle: GLOBAL_KEY, // 是否同时翻译页面标题
transSelected: GLOBAL_KEY, // 是否启用划词翻译
detectRemote: GLOBAL_KEY, // 是否使用远程语言检测
skipLangs: [], // 不翻译的语言
// detectRemote: GLOBAL_KEY, // 是否使用远程语言检测 (移回setting)
// skipLangs: [], // 不翻译的语言 (移回setting)
// fixerSelector: "", // 修复函数选择器 (暂时作废)
// fixerFunc: GLOBAL_KEY, // 修复函数 (暂时作废)
transStartHook: "", // 钩子函数
@@ -132,8 +132,8 @@ export const GLOBLA_RULE = {
transTag: DEFAULT_TRANS_TAG, // 译文元素标签
transTitle: "false", // 是否同时翻译页面标题
transSelected: "true", // 是否启用划词翻译
detectRemote: "true", // 是否使用远程语言检测
skipLangs: [], // 不翻译的语言
// detectRemote: "true", // 是否使用远程语言检测 (移回setting)
// skipLangs: [], // 不翻译的语言 (移回setting)
// fixerSelector: "", // 修复函数选择器 (暂时作废)
// fixerFunc: "-", // 修复函数 (暂时作废)
transStartHook: "", // 钩子函数

View File

@@ -4,7 +4,6 @@ import {
OPT_TRANS_MICROSOFT,
DEFAULT_API_LIST,
} from "./api";
import { DEFAULT_OW_RULE } from "./rules";
// 默认快捷键
export const OPT_SHORTCUT_TRANSLATE = "toggleTranslate";
@@ -128,7 +127,7 @@ export const DEFAULT_SETTING = {
injectRules: true, // 是否注入订阅规则
fabClickAction: 0, // 悬浮按钮点击行为
// injectWebfix: true, // 是否注入修复补丁(作废)
// detectRemote: false, // 是否使用远程语言检测(移至rule,作废)
detectRemote: false, // 是否使用远程语言检测 (从rule移回)
// contextMenus: true, // 是否添加右键菜单(作废)
contextMenuType: 1, // 右键菜单类型(0不显示1简单菜单2多级菜单)
// transTag: DEFAULT_TRANS_TAG, // 译文元素标签(移至rule作废)
@@ -145,6 +144,7 @@ export const DEFAULT_SETTING = {
blacklist: DEFAULT_BLACKLIST.join(",\n"), // 禁用翻译名单
csplist: DEFAULT_CSPLIST.join(",\n"), // 禁用CSP名单
// disableLangs: [], // 不翻译的语言(移至rule作废)
skipLangs: [], // 不翻译的语言从rule移回
transInterval: 100, // 翻译等待时间
langDetector: OPT_TRANS_MICROSOFT, // 远程语言识别服务
mouseHoverSetting: DEFAULT_MOUSE_HOVER_SETTING, // 鼠标悬停翻译