feat: disable languages

This commit is contained in:
Gabe Yuan
2023-11-28 11:11:59 +08:00
parent 22c50e7765
commit da368ee612
4 changed files with 35 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ import {
OPT_SHORTCUT_STYLE,
OPT_SHORTCUT_POPUP,
OPT_SHORTCUT_SETTING,
OPT_LANGS_TO,
DEFAULT_BLACKLIST,
} from "../../config";
import { useShortcut } from "../../hooks/Shortcut";
@@ -43,6 +44,7 @@ export default function Settings() {
const { fab, updateFab } = useFab();
const handleChange = (e) => {
console.log("e", e);
e.preventDefault();
let { name, value } = e.target;
switch (name) {
@@ -92,6 +94,7 @@ export default function Settings() {
detectRemote = false,
touchTranslate = 2,
blacklist = DEFAULT_BLACKLIST.join(",\n"),
disableLangs = [],
} = setting;
const { isHide = false } = fab || {};
@@ -220,6 +223,24 @@ export default function Settings() {
<FormHelperText>{i18n("detect_lang_remote_help")}</FormHelperText>
</FormControl>
<FormControl>
<InputLabel>{i18n("disable_langs")}</InputLabel>
<Select
multiple
name="disableLangs"
value={disableLangs}
label={i18n("disable_langs")}
onChange={handleChange}
>
{OPT_LANGS_TO.map(([langKey, langName]) => (
<MenuItem key={langKey} value={langKey}>
{langName}
</MenuItem>
))}
</Select>
<FormHelperText>{i18n("disable_langs_helper")}</FormHelperText>
</FormControl>
{isExt ? (
<FormControl size="small">
<InputLabel>{i18n("if_clear_cache")}</InputLabel>