feat: support custom terms

This commit is contained in:
Gabe Yuan
2024-01-19 16:02:53 +08:00
parent 59f9dd697f
commit d5fc69e210
13 changed files with 85 additions and 32 deletions

View File

@@ -10,6 +10,7 @@ export const DEFAULT_RULE = {
pattern: "",
selector: "",
keepSelector: "",
terms: "",
translator: GLOBAL_KEY,
fromLang: GLOBAL_KEY,
toLang: GLOBAL_KEY,
@@ -188,9 +189,10 @@ const RULES_MAP = {
export const BUILTIN_RULES = Object.entries(RULES_MAP)
.sort((a, b) => a[0].localeCompare(b[0]))
.map(([pattern, [selector, keepSelector = ""]]) => ({
.map(([pattern, [selector, keepSelector = "", terms = ""]]) => ({
...DEFAULT_RULE,
pattern,
selector,
keepSelector,
terms,
}));