fix: variable name

This commit is contained in:
Gabe
2025-07-02 13:38:30 +08:00
parent 165da4e559
commit 704ebdc9d7
3 changed files with 9 additions and 9 deletions

View File

@@ -2,7 +2,7 @@ import queryString from "query-string";
import { fetchData } from "../libs/fetch"; import { fetchData } from "../libs/fetch";
import { import {
OPT_TRANS_GOOGLE, OPT_TRANS_GOOGLE,
OPT_TRANS_GOOGLE2, OPT_TRANS_GOOGLE_2,
OPT_TRANS_MICROSOFT, OPT_TRANS_MICROSOFT,
OPT_TRANS_DEEPL, OPT_TRANS_DEEPL,
OPT_TRANS_DEEPLFREE, OPT_TRANS_DEEPLFREE,
@@ -261,7 +261,7 @@ export const apiTranslate = async ({
trText = res.sentences.map((item) => item.trans).join(" "); trText = res.sentences.map((item) => item.trans).join(" ");
isSame = to === res.src; isSame = to === res.src;
break; break;
case OPT_TRANS_GOOGLE2: case OPT_TRANS_GOOGLE_2:
trText = res?.[0]?.[0]||""; trText = res?.[0]?.[0]||"";
isSame = to === res.src; isSame = to === res.src;
break; break;

View File

@@ -1,7 +1,7 @@
import queryString from "query-string"; import queryString from "query-string";
import { import {
OPT_TRANS_GOOGLE, OPT_TRANS_GOOGLE,
OPT_TRANS_GOOGLE2, OPT_TRANS_GOOGLE_2,
OPT_TRANS_MICROSOFT, OPT_TRANS_MICROSOFT,
OPT_TRANS_DEEPL, OPT_TRANS_DEEPL,
OPT_TRANS_DEEPLFREE, OPT_TRANS_DEEPLFREE,
@@ -506,7 +506,7 @@ export const genTransReq = ({ translator, text, from, to }, apiSetting) => {
switch (translator) { switch (translator) {
case OPT_TRANS_GOOGLE: case OPT_TRANS_GOOGLE:
return genGoogle(args); return genGoogle(args);
case OPT_TRANS_GOOGLE2: case OPT_TRANS_GOOGLE_2:
return genGoogle2(args); return genGoogle2(args);
case OPT_TRANS_MICROSOFT: case OPT_TRANS_MICROSOFT:
return genMicrosoft(args); return genMicrosoft(args);

View File

@@ -117,7 +117,7 @@ export const DEFAULT_USER_AGENT =
export const OPT_DICT_BAIDU = "Baidu"; export const OPT_DICT_BAIDU = "Baidu";
export const OPT_TRANS_GOOGLE = "Google"; 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_MICROSOFT = "Microsoft";
export const OPT_TRANS_DEEPL = "DeepL"; export const OPT_TRANS_DEEPL = "DeepL";
export const OPT_TRANS_DEEPLX = "DeepLX"; 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_CUSTOMIZE_5 = "Custom5";
export const OPT_TRANS_ALL = [ export const OPT_TRANS_ALL = [
OPT_TRANS_GOOGLE, OPT_TRANS_GOOGLE,
OPT_TRANS_GOOGLE2, OPT_TRANS_GOOGLE_2,
OPT_TRANS_MICROSOFT, OPT_TRANS_MICROSOFT,
OPT_TRANS_BAIDU, OPT_TRANS_BAIDU,
OPT_TRANS_TENCENT, 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_FROM = [["auto", "Auto-detect"], ...OPT_LANGS_TO];
export const OPT_LANGS_SPECIAL = { export const OPT_LANGS_SPECIAL = {
[OPT_TRANS_GOOGLE]: new Map(OPT_LANGS_FROM.map(([key]) => [key, key])), [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_TRANS_MICROSOFT]: new Map([
...OPT_LANGS_FROM.map(([key]) => [key, key]), ...OPT_LANGS_FROM.map(([key]) => [key, key]),
["auto", ""], ["auto", ""],
@@ -590,12 +590,12 @@ export const DEFAULT_TRANS_APIS = {
isDisabled: false, // 是否禁用 isDisabled: false, // 是否禁用
httpTimeout: DEFAULT_HTTP_TIMEOUT, // 超时时间 httpTimeout: DEFAULT_HTTP_TIMEOUT, // 超时时间
}, },
[OPT_TRANS_GOOGLE2]: { [OPT_TRANS_GOOGLE_2]: {
url: URL_GOOGLE_TRAN2, url: URL_GOOGLE_TRAN2,
key: DEFAULT_GOOGLE_API_KEY, key: DEFAULT_GOOGLE_API_KEY,
fetchLimit: DEFAULT_FETCH_LIMIT, fetchLimit: DEFAULT_FETCH_LIMIT,
fetchInterval: DEFAULT_FETCH_INTERVAL, fetchInterval: DEFAULT_FETCH_INTERVAL,
apiName: OPT_TRANS_GOOGLE2, apiName: OPT_TRANS_GOOGLE_2,
isDisabled: false, isDisabled: false,
httpTimeout: DEFAULT_HTTP_TIMEOUT, httpTimeout: DEFAULT_HTTP_TIMEOUT,
}, },