From 704ebdc9d7fb625d0f23bb4a01b66434c191d89b Mon Sep 17 00:00:00 2001 From: Gabe Date: Wed, 2 Jul 2025 13:38:30 +0800 Subject: [PATCH] fix: variable name --- src/apis/index.js | 4 ++-- src/apis/trans.js | 4 ++-- src/config/index.js | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/apis/index.js b/src/apis/index.js index 41f3302..bf0a0b0 100644 --- a/src/apis/index.js +++ b/src/apis/index.js @@ -2,7 +2,7 @@ import queryString from "query-string"; import { fetchData } from "../libs/fetch"; import { OPT_TRANS_GOOGLE, - OPT_TRANS_GOOGLE2, + OPT_TRANS_GOOGLE_2, OPT_TRANS_MICROSOFT, OPT_TRANS_DEEPL, OPT_TRANS_DEEPLFREE, @@ -261,7 +261,7 @@ export const apiTranslate = async ({ trText = res.sentences.map((item) => item.trans).join(" "); isSame = to === res.src; break; - case OPT_TRANS_GOOGLE2: + case OPT_TRANS_GOOGLE_2: trText = res?.[0]?.[0]||""; isSame = to === res.src; break; diff --git a/src/apis/trans.js b/src/apis/trans.js index bd20b90..b31e3d3 100644 --- a/src/apis/trans.js +++ b/src/apis/trans.js @@ -1,7 +1,7 @@ import queryString from "query-string"; import { OPT_TRANS_GOOGLE, - OPT_TRANS_GOOGLE2, + OPT_TRANS_GOOGLE_2, OPT_TRANS_MICROSOFT, OPT_TRANS_DEEPL, OPT_TRANS_DEEPLFREE, @@ -506,7 +506,7 @@ export const genTransReq = ({ translator, text, from, to }, apiSetting) => { switch (translator) { case OPT_TRANS_GOOGLE: return genGoogle(args); - case OPT_TRANS_GOOGLE2: + case OPT_TRANS_GOOGLE_2: return genGoogle2(args); case OPT_TRANS_MICROSOFT: return genMicrosoft(args); diff --git a/src/config/index.js b/src/config/index.js index acb1cd0..33c01d5 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -117,7 +117,7 @@ export const DEFAULT_USER_AGENT = export const OPT_DICT_BAIDU = "Baidu"; export const OPT_TRANS_GOOGLE = "Google"; -export const OPT_TRANS_GOOGLE2 = "Google2"; +export const OPT_TRANS_GOOGLE_2 = "Google2"; export const OPT_TRANS_MICROSOFT = "Microsoft"; export const OPT_TRANS_DEEPL = "DeepL"; export const OPT_TRANS_DEEPLX = "DeepLX"; @@ -142,7 +142,7 @@ export const OPT_TRANS_CUSTOMIZE_4 = "Custom4"; export const OPT_TRANS_CUSTOMIZE_5 = "Custom5"; export const OPT_TRANS_ALL = [ OPT_TRANS_GOOGLE, - OPT_TRANS_GOOGLE2, + OPT_TRANS_GOOGLE_2, OPT_TRANS_MICROSOFT, OPT_TRANS_BAIDU, OPT_TRANS_TENCENT, @@ -216,7 +216,7 @@ export const OPT_LANGS_TO = [ export const OPT_LANGS_FROM = [["auto", "Auto-detect"], ...OPT_LANGS_TO]; export const OPT_LANGS_SPECIAL = { [OPT_TRANS_GOOGLE]: new Map(OPT_LANGS_FROM.map(([key]) => [key, key])), - [OPT_TRANS_GOOGLE2]: new Map(OPT_LANGS_FROM.map(([key]) => [key, key])), + [OPT_TRANS_GOOGLE_2]: new Map(OPT_LANGS_FROM.map(([key]) => [key, key])), [OPT_TRANS_MICROSOFT]: new Map([ ...OPT_LANGS_FROM.map(([key]) => [key, key]), ["auto", ""], @@ -590,12 +590,12 @@ export const DEFAULT_TRANS_APIS = { isDisabled: false, // 是否禁用 httpTimeout: DEFAULT_HTTP_TIMEOUT, // 超时时间 }, - [OPT_TRANS_GOOGLE2]: { + [OPT_TRANS_GOOGLE_2]: { url: URL_GOOGLE_TRAN2, key: DEFAULT_GOOGLE_API_KEY, fetchLimit: DEFAULT_FETCH_LIMIT, fetchInterval: DEFAULT_FETCH_INTERVAL, - apiName: OPT_TRANS_GOOGLE2, + apiName: OPT_TRANS_GOOGLE_2, isDisabled: false, httpTimeout: DEFAULT_HTTP_TIMEOUT, },