Skip to content

Commit ede013b

Browse files
authored
🌐 翻译更新 (#920)
1 parent 88d8bdf commit ede013b

7 files changed

Lines changed: 29 additions & 29 deletions

File tree

src/locales/de-DE/translation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@
483483
"custom_eslint_rules_config": "Benutzerdefinierte ESLint-Regelkonfiguration (JSON-Format)",
484484
"light": "Heller Modus",
485485
"dark": "Dunkler Modus",
486-
"individual_edit": "Einzeln bearbeiten",
487-
"batch_edit": "Bulk edit",
486+
"individual_edit": "Einzelbearbeitung",
487+
"batch_edit": "Stapelbearbeitung",
488488
"script_code": "Skriptcode",
489489
"enter_search_value": "Bitte geben Sie {{search}} für die Suche ein",
490490
"script_run_env": {

src/locales/vi-VN/translation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@
483483
"custom_eslint_rules_config": "Cấu hình quy tắc eslint tùy chỉnh (định dạng json)",
484484
"light": "Sáng",
485485
"dark": "Tối",
486-
"individual_edit": "Chỉnh sửa riêng lẻ",
486+
"individual_edit": "Chỉnh sửa cá nhân",
487487
"batch_edit": "Chỉnh sửa hàng loạt",
488-
"script_code": "script",
488+
"script_code": "kịch bản",
489489
"enter_search_value": "Nhập {{search}} để tìm kiếm",
490490
"script_run_env": {
491491
"title": "Môi trường chạy",

src/locales/zh-TW/translation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@
483483
"custom_eslint_rules_config": "自訂 ESLint 規則設定(JSON 格式)",
484484
"light": "淺色模式",
485485
"dark": "暗色模式",
486-
"individual_edit": "单独编辑",
486+
"individual_edit": "單獨編輯",
487487
"batch_edit": "批量編輯",
488-
"script_code": "脚本代码",
488+
"script_code": "腳本代碼",
489489
"enter_search_value": "請輸入 {{search}} 進行搜尋",
490490
"script_run_env": {
491491
"title": "運作環境",

src/pages/install/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function App() {
117117
});
118118

119119
// 刷新 timestamp, 使 10s~15s 后不会被立即清掉
120-
// 每五分鐘刷新一次db记录的timestamp,使开啟中的安装页面的fileHandle不会被刷掉
120+
// 每五分钟刷新一次db记录的timestamp,使开启中的安装页面的fileHandle不会被刷掉
121121
intervalExecution(`${cIdKey}liveFileHandle`, () => saveHandle(fid, fileHandle), 5 * 60 * 1000, true);
122122

123123
const code = await file.text();
@@ -162,10 +162,10 @@ function App() {
162162
Message.error(t("script_info_load_failed") + " " + e.message);
163163
} finally {
164164
// fileHandle 保留处理方式(暂定):
165-
// fileHandle 会保留一段足够时间,避免用户重新刷画面,重啟瀏览器等操作后,安装页变得空白一片。
165+
// fileHandle 会保留一段足够时间,避免用户重新刷画面,重启浏览器等操作后,安装页变得空白一片。
166166
// 处理会在所有Tab都载入后(不包含睡眠Tab)进行,因此延迟 10s~15s 让处理有足够时间。
167-
// 安装页面关掉后15分鐘为不保留状态,会在安装画面再次打开时(其他脚本安装),进行清除。
168-
const delay = Math.floor(5000 * Math.random()) + 10000; // 使用乱数时间避免瀏览器重啟时大量Tabs同时执行DB清除
167+
// 安装页面关掉后15分钟为不保留状态,会在安装画面再次打开时(其他脚本安装),进行清除。
168+
const delay = Math.floor(5000 * Math.random()) + 10000; // 使用乱数时间避免浏览器重启时大量Tabs同时执行DB清除
169169
timeoutExecution(`${cIdKey}cleanupFileHandle`, cleanupOldHandles, delay);
170170
}
171171
};
@@ -452,7 +452,7 @@ function App() {
452452
}
453453
// 去除React特性
454454
const [handle] = [localFileHandle];
455-
unmountFileTrack(handle); // 避免重覆追踪
455+
unmountFileTrack(handle); // 避免重复追踪
456456
const uuid = scriptInfo?.uuid;
457457
const fileName = handle?.name;
458458
if (!uuid || !fileName) {

src/pkg/utils/file-tracker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const callback = async (records: FileSystemChangeRecord[], observer: FileSystemO
1818
if (!isSame) continue;
1919
// 调用安装
2020
const file = await root.getFile();
21-
// 避免重覆更新
21+
// 避免重复更新
2222
if (ftInfo.lastModified === file.lastModified) continue;
2323
ftInfo.lastModified = file.lastModified;
2424
const code = await file.text();

src/pkg/utils/url_matcher.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ describe.concurrent("extractSchemesOfGlobs", () => {
4949
expect(extractSchemesOfGlobs(["https://www.google.com/a?b*c*"])).toEqual(["*://*/*"]);
5050
expect(extractSchemesOfGlobs(["http://www.google.com/a?b*c*"])).toEqual(["*://*/*"]);
5151
expect(extractSchemesOfGlobs(["https://*google.com/*"])).toEqual(["*://*/*"]);
52-
// 預設包含 *://*/*
52+
// 预设包含 *://*/*
5353
expect(extractSchemesOfGlobs(["file:///mydrive/t*.html"])).toEqual(["*://*/*", "file:///*"]);
5454
expect(extractSchemesOfGlobs(["file:///my?ive/t*.html"])).toEqual(["*://*/*", "file:///*"]);
5555
// 其他scheme
5656
expect(extractSchemesOfGlobs(["my-protocol://hello/world/t_?*.html"])).toEqual(["*://*/*", "my-protocol://*/*"]);
5757
expect(extractSchemesOfGlobs(["tcp://hello/world/t_?*.html"])).toEqual(["*://*/*", "tcp://*/*"]);
5858
expect(extractSchemesOfGlobs(["ab://hello/world/t_?*.html"])).toEqual(["*://*/*", "ab://*/*"]);
59-
// 無視無效scheme
59+
// 无视无效scheme
6060
expect(extractSchemesOfGlobs(["myl*://hello/world/t_?*.html"])).toEqual(["*://*/*"]);
6161
expect(extractSchemesOfGlobs(["my?l//hello/world/t_?*.html"])).toEqual(["*://*/*"]);
6262
expect(extractSchemesOfGlobs(["*m?yl//hello/world/t_?*.html"])).toEqual(["*://*/*"]);
@@ -80,7 +80,7 @@ describe.concurrent("extractSchemesOfGlobs", () => {
8080
expect(extractSchemesOfGlobs(["my-place://mydrive/*", "www.abc.com/*"]).sort()).toEqual(
8181
["my-place://*/*", "*://*/*"].sort()
8282
);
83-
// 3個不重覆 (file:///)
83+
// 3个不重复 (file:///)
8484
expect(
8585
extractSchemesOfGlobs(["https://www.abc.com/*", "file:///mydrive/*", "http://www.def.com/*"]).sort()
8686
).toEqual(["file:///*", "*://*/*"].sort());
@@ -98,7 +98,7 @@ describe.concurrent("extractSchemesOfGlobs", () => {
9898
]).sort()
9999
).toEqual(["file:///*", "*://*/*"].sort());
100100

101-
// 3個不重覆 (my-path://)
101+
// 3个不重复 (my-path://)
102102
expect(
103103
extractSchemesOfGlobs(["https://www.abc.com/*", "my-path://mydrive/*", "http://www.def.com/*"]).sort()
104104
).toEqual(["my-path://*/*", "*://*/*"].sort());
@@ -265,7 +265,7 @@ describe.concurrent("getApiMatchesAndGlobs-1 (基础测试)", () => {
265265
expect(includeGlobs).toEqual([]);
266266
});
267267
it.concurrent("match2", () => {
268-
// 由於 *hello* ,故要 match 全部页面
268+
// 由于 *hello* ,故要 match 全部页面
269269
const scriptUrlPatterns = extractUrlPatterns(["@include *hello*"]);
270270
const { matches, includeGlobs } = getApiMatchesAndGlobs(scriptUrlPatterns);
271271

@@ -274,7 +274,7 @@ describe.concurrent("getApiMatchesAndGlobs-1 (基础测试)", () => {
274274
});
275275

276276
it.concurrent("match3", () => {
277-
// 由於 *hello* ,故要 match 全部页面
277+
// 由于 *hello* ,故要 match 全部页面
278278
const scriptUrlPatterns = extractUrlPatterns([
279279
"@match http://google.com/*",
280280
"@match https://google.com/*",
@@ -287,7 +287,7 @@ describe.concurrent("getApiMatchesAndGlobs-1 (基础测试)", () => {
287287
});
288288

289289
it.concurrent("match4", () => {
290-
// 由於 *hello* ,故要 match 全部页面
290+
// 由于 *hello* ,故要 match 全部页面
291291
// @match 有 file:/// ,故追加 file:///* 至match
292292
const scriptUrlPatterns = extractUrlPatterns([
293293
"@match http://google.com/*",
@@ -425,7 +425,7 @@ describe.concurrent("getApiMatchesAndGlobs-2 (实际例子测试)", () => {
425425
});
426426

427427
describe.concurrent("getApiMatchesAndGlobs-3 (全面性测试)", () => {
428-
it.concurrent("标準match格式", () => {
428+
it.concurrent("标准match格式", () => {
429429
const scriptUrlPatterns = extractUrlPatterns([
430430
"// @include *://www.bilibili.com/video/*",
431431
"// @include *://www.bilibili.com/list/*",
@@ -559,7 +559,7 @@ describe.concurrent("getApiMatchesAndGlobs-3 (全面性测试)", () => {
559559

560560
it.concurrent("[B2] regex转换成*://*/* (match only)", () => {
561561
// /live\\.bilibili\\.com/ 可匹配 123live.bilibili.com, www.live.bilibili.com, myhome.com/live.bilibili.com
562-
// 相对於 (1) ,regex为较简单,glob部份不需转换
562+
// 相对于 (1) ,regex为较简单,glob部份不需转换
563563
const scriptUrlPatterns = extractUrlPatterns([
564564
"// @include *://www.bilibili.com/video/*",
565565
"// @include *://www.bilibili.com/list/*",
@@ -790,7 +790,7 @@ describe.concurrent("getApiMatchesAndGlobs-3 (全面性测试)", () => {
790790
});
791791

792792
it.concurrent("[F1] 混合 regex/glob pattern & file scheme 测试解析正确性", () => {
793-
// 由於regex pattern 而fallback至全部页面
793+
// 由于regex pattern 而fallback至全部页面
794794
// 含有 file:///,追加 "file:///*"
795795
const scriptUrlPatterns = extractUrlPatterns([
796796
"// @include *://www.google.com/video/*",

src/pkg/utils/url_matcher.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ export const enum RuleTypeBit {
1515

1616
export type URLRuleEntry = {
1717
ruleType: RuleType;
18-
ruleContent: string | string[] | [string, string]; // 由於 cache 设计,ruleContent 不能含有 RegExp
18+
ruleContent: string | string[] | [string, string]; // 由于 cache 设计,ruleContent 不能含有 RegExp
1919
ruleTag: string;
2020
patternString: string;
2121
};
2222

2323
const URL_MATCH_CACHE_MAX_SIZE = 512; // 用来做简单缓存,512 算是足够大小应付需要。
2424

2525
// 检查 @match @include @exclude 是否按照MV3的 match pattern
26-
// export 只用於测试,不要在外部直接引用 checkUrlMatch
26+
// export 只用于测试,不要在外部直接引用 checkUrlMatch
2727
export function checkUrlMatch(s: string) {
2828
s = s.trim();
2929

@@ -57,7 +57,7 @@ export function checkUrlMatch(s: string) {
5757
}
5858

5959
const globSplit = (text: string) => {
60-
text = text.replace(/\*{2,}/g, "*"); // api定义的 glob * 是等价於 glob **
60+
text = text.replace(/\*{2,}/g, "*"); // api定义的 glob * 是等价于 glob **
6161
text = text.replace(/\*(\?+)/g, "$1*"); // "*????" 改成 "????*",避免 backward 处理
6262
return text.split(/([*?])/g);
6363
};
@@ -124,15 +124,15 @@ export const extractUrlPatterns = (lines: string[]): URLRuleEntry[] => {
124124
if (tldIdx > 0) {
125125
// 最短匹配*.tld/
126126
const left = content.substring(0, tldIdx);
127-
// 斜线不能多於2个, 例如 https://www.hello.com/abc.tld/123
127+
// 斜线不能多于2个, 例如 https://www.hello.com/abc.tld/123
128128
if (left.split("/").length <= 3) {
129129
const right = content.substring(tldIdx + 5);
130130
content = `${left}.??*/${right}`;
131131
}
132132
}
133133
}
134134
// 内部处理用
135-
// 适用於 glob pattern 及 match pattern
135+
// 适用于 glob pattern 及 match pattern
136136
if (content.includes("**")) {
137137
// SC内部处理不能处理多过一个以上连续星号
138138
content = content.replace(/\*{2,}/g, "*"); // glob * 修正
@@ -450,14 +450,14 @@ export const getApiMatchesAndGlobs = (scriptUrlPatterns: URLRuleEntry[]) => {
450450
}
451451

452452
if (apiIncludeGlobs.includes(globPattern)) {
453-
// 已存在,不重覆添加
453+
// 已存在,不重复添加
454454
continue;
455455
}
456456
apiIncludeGlobs.push(globPattern);
457457
}
458458
}
459459

460-
// 由於有 glob pattern, 会先假设需要全域匹配,确保 UserScript API 的注入有效
460+
// 由于有 glob pattern, 会先假设需要全域匹配,确保 UserScript API 的注入有效
461461
if (apiIncludeGlobs.length > 0 && !matchAll) matchAll = ["*://*/*"];
462462

463463
// 为了改变现有的 match pattern, 现有的 match pattern 全部转换至 glob pattern, 并添加在目前的 globs

0 commit comments

Comments
 (0)