diff --git a/src/config/i18n.js b/src/config/i18n.js
index fee7740..d0c1ce2 100644
--- a/src/config/i18n.js
+++ b/src/config/i18n.js
@@ -930,4 +930,8 @@ export const I18N = {
zh: `翻译移除时运行,入参为: 翻译节点。`,
en: `Run when translation is removed, the input parameters are: translation node.`,
},
+ english_dict: {
+ zh: `英文词典`,
+ en: `English Dictionary`,
+ },
};
diff --git a/src/config/index.js b/src/config/index.js
index bf49ed7..cea947f 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -102,6 +102,8 @@ export const URL_NIUTRANS_REG =
export const DEFAULT_USER_AGENT =
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36";
+export const OPT_DICT_BAIDU = "Baidu";
+
export const OPT_TRANS_GOOGLE = "Google";
export const OPT_TRANS_MICROSOFT = "Microsoft";
export const OPT_TRANS_DEEPL = "DeepL";
@@ -487,6 +489,7 @@ export const DEFAULT_TRANBOX_SETTING = {
followSelection: false, // 翻译框是否跟随选中文本
triggerMode: OPT_TRANBOX_TRIGGER_CLICK, // 触发翻译方式
extStyles: "", // 附加样式
+ enDict: OPT_DICT_BAIDU, // 英文词典
};
// 订阅列表
diff --git a/src/views/Options/Tranbox.js b/src/views/Options/Tranbox.js
index f173d1d..337c1f5 100644
--- a/src/views/Options/Tranbox.js
+++ b/src/views/Options/Tranbox.js
@@ -9,6 +9,7 @@ import {
OPT_LANGS_TO,
OPT_TRANBOX_TRIGGER_CLICK,
OPT_TRANBOX_TRIGGER_ALL,
+ OPT_DICT_BAIDU,
} from "../../config";
import ShortcutInput from "./ShortcutInput";
import FormControlLabel from "@mui/material/FormControlLabel";
@@ -63,6 +64,7 @@ export default function Tranbox() {
followSelection = false,
triggerMode = OPT_TRANBOX_TRIGGER_CLICK,
extStyles = "",
+ enDict = OPT_DICT_BAIDU,
} = tranboxSetting;
return (
@@ -143,6 +145,18 @@ export default function Tranbox() {
))}
+
+
+
+
+
)}
- {(!simpleStyle || !isValidWord(text) || !toLang.startsWith("zh")) && (
+ {(!simpleStyle ||
+ !isValidWord(text) ||
+ !toLang.startsWith("zh") ||
+ enDict === "-") && (
)}
-
-
+ {enDict !== "-" && (
+ <>
+
+
+ >
+ )}
);
}
@@ -277,6 +285,7 @@ export default function TranBox({
setFollowSelection,
extStyles,
langDetector,
+ enDict,
}) {
const [mouseHover, setMouseHover] = useState(false);
return (
@@ -310,6 +319,7 @@ export default function TranBox({
transApis={transApis}
simpleStyle={simpleStyle}
langDetector={langDetector}
+ enDict={enDict}
/>
diff --git a/src/views/Selection/index.js b/src/views/Selection/index.js
index 4982f76..17431af 100644
--- a/src/views/Selection/index.js
+++ b/src/views/Selection/index.js
@@ -10,6 +10,7 @@ import {
OPT_TRANBOX_TRIGGER_CLICK,
OPT_TRANBOX_TRIGGER_HOVER,
OPT_TRANBOX_TRIGGER_SELECT,
+ OPT_DICT_BAIDU,
} from "../../config";
import { isMobile } from "../../libs/mobile";
import { kissLog } from "../../libs/log";
@@ -34,6 +35,7 @@ export default function Slection({
btnOffsetY,
boxOffsetX = 0,
boxOffsetY = 10,
+ enDict = OPT_DICT_BAIDU,
} = tranboxSetting;
const boxWidth =
@@ -236,6 +238,7 @@ export default function Slection({
setFollowSelection={setFollowSelection}
extStyles={extStyles}
langDetector={langDetector}
+ enDict={enDict}
/>
)}