cc-translate 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -32
- package/index.d.ts +3 -3
- package/index.js +296 -132
- package/lib/cache/index.d.ts +8 -4
- package/lib/cache/index.d.ts.map +1 -1
- package/lib/cache/index.js +77 -12
- package/lib/translation-format.d.ts +5 -0
- package/lib/translation-format.d.ts.map +1 -0
- package/lib/translation-format.js +31 -0
- package/lib/translation-metadata.d.ts +4 -1
- package/lib/translation-metadata.d.ts.map +1 -1
- package/lib/translation-metadata.js +49 -22
- package/lib/translation-response.d.ts +7 -0
- package/lib/translation-response.d.ts.map +1 -1
- package/lib/translation-response.js +122 -0
- package/package.json +3 -2
- package/types/index.d.ts +20 -4
- package/types/index.d.ts.map +1 -1
- package/CHANGELOG.md +0 -78
package/lib/cache/index.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { IDeleteSingleCacheParams, IGenerateCacheParams, IJson, IRegisterLanguageCacheFile, ReferenceCacheState, ReferenceSnapshot } from "../../types/index.js";
|
|
1
|
+
import { IDeleteSingleCacheParams, IGenerateCacheParams, IJson, IRegisterLanguageCacheFile, MissingReferenceIds, ReferenceCacheState, ReferenceSnapshot, SourceCache } from "../../types/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* 和翻译缓存json文件对比 返回存在更改的json文件
|
|
4
4
|
* @param {object} cacheObject 已经缓存的对象
|
|
5
5
|
* @param {object} translateObject 需要翻译的对象
|
|
6
6
|
* @returns {object} 存在修改的对象
|
|
7
7
|
*/
|
|
8
|
-
export declare const translateJSONDiffToJson: (cacheObject:
|
|
8
|
+
export declare const translateJSONDiffToJson: (cacheObject: SourceCache, translateObject: IJson) => IJson;
|
|
9
9
|
/**
|
|
10
10
|
* 获取缓存文件
|
|
11
11
|
* @param {string} filePath 缓存文件路径
|
|
12
12
|
* @returns {Promise<{key:value}>}
|
|
13
13
|
*/
|
|
14
|
-
export declare const getCacheFileSync: (filePath: string) => Promise<
|
|
15
|
-
export declare const readReferenceCache: (filePath: string) => Map<string, ReferenceSnapshot>;
|
|
14
|
+
export declare const getCacheFileSync: (filePath: string) => Promise<SourceCache>;
|
|
15
|
+
export declare const readReferenceCache: (filePath: string, previouslyMissing?: Map<string, Set<string>>) => Map<string, ReferenceSnapshot>;
|
|
16
16
|
export declare const writeReferenceCache: ({ filePath, observed }: ReferenceCacheState) => void;
|
|
17
|
+
export declare const referenceDigest: (snapshot: ReferenceSnapshot) => string;
|
|
18
|
+
export declare const getRejectedReferences: (cache: SourceCache) => IJson;
|
|
19
|
+
export declare const getMissingReferenceIds: (cache: SourceCache) => MissingReferenceIds;
|
|
20
|
+
export declare const writeMissingReferenceIds: (filePath: string, updates: MissingReferenceIds) => Promise<void>;
|
|
17
21
|
/**
|
|
18
22
|
* 注册语言缓存文件
|
|
19
23
|
* @param {string} language
|
package/lib/cache/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/cache/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/cache/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAE9B;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,gBACrB,WAAW,mBACP,KAAK,UAiBvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,aAAoB,MAAM,KAAG,OAAO,CAAC,WAAW,CAM5E,CAAC;AAGF,eAAO,MAAM,kBAAkB,aACnB,MAAM,sBACI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,KAC3C,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAmB/B,CAAC;AAaF,eAAO,MAAM,mBAAmB,2BAA4B,mBAAmB,SAG9E,CAAC;AAGF,eAAO,MAAM,eAAe,aAAc,iBAAiB,KAAG,MAC8B,CAAC;AAE7F,eAAO,MAAM,qBAAqB,UAAW,WAAW,KAAG,KAI1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,UAAW,WAAW,KAAG,mBAI3D,CAAC;AAWF,eAAO,MAAM,wBAAwB,aAAoB,MAAM,WAAW,mBAAmB,kBAI5F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,WAC5B,0BAA0B,kBA+BnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,WAAkB,oBAAoB,kBAwC/D,CAAC;AAwCF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,WAAY,wBAAwB,SAmChE,CAAC"}
|
package/lib/cache/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import path from "path";
|
|
11
11
|
import fs from "fs";
|
|
12
|
-
import { randomUUID } from "node:crypto";
|
|
12
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
13
13
|
import { intersection, notExistsToCreateFile, readJsonFileSync, } from "../utils.js";
|
|
14
14
|
/**
|
|
15
15
|
* 和翻译缓存json文件对比 返回存在更改的json文件
|
|
@@ -48,34 +48,94 @@ export const getCacheFileSync = (filePath) => __awaiter(void 0, void 0, void 0,
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
// 参考快照单独存储,保留现有源文案缓存的格式。
|
|
51
|
-
export const readReferenceCache = (filePath) =>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
export const readReferenceCache = (filePath, previouslyMissing) => {
|
|
52
|
+
const snapshots = new Map();
|
|
53
|
+
if (!fs.existsSync(filePath))
|
|
54
|
+
return snapshots;
|
|
55
|
+
const stored = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
56
|
+
for (const [key, snapshot] of Object.entries(stored)) {
|
|
57
|
+
const entries = Object.entries(snapshot);
|
|
58
|
+
// 旧格式中的 null 只参与本次变更判断,不再写入参考缓存。
|
|
59
|
+
const missing = entries.filter(([, value]) => value === null).map(([id]) => id);
|
|
60
|
+
if (missing.length)
|
|
61
|
+
previouslyMissing === null || previouslyMissing === void 0 ? void 0 : previouslyMissing.set(key, new Set(missing));
|
|
62
|
+
const matched = entries.filter((entry) => typeof entry[1] === "string" && entry[1].trim() !== "");
|
|
63
|
+
if (matched.length)
|
|
64
|
+
snapshots.set(key, Object.fromEntries(matched));
|
|
65
|
+
}
|
|
66
|
+
return snapshots;
|
|
67
|
+
};
|
|
68
|
+
const writeCacheJson = (filePath, value) => {
|
|
55
69
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
56
70
|
const temporaryPath = `${filePath}.${randomUUID()}.tmp`;
|
|
57
71
|
try {
|
|
58
|
-
fs.writeFileSync(temporaryPath, JSON.stringify(
|
|
72
|
+
fs.writeFileSync(temporaryPath, JSON.stringify(value, null, 2));
|
|
59
73
|
fs.renameSync(temporaryPath, filePath);
|
|
60
74
|
}
|
|
61
75
|
finally {
|
|
62
76
|
fs.rmSync(temporaryPath, { force: true });
|
|
63
77
|
}
|
|
64
78
|
};
|
|
79
|
+
export const writeReferenceCache = ({ filePath, observed }) => {
|
|
80
|
+
if (observed.size)
|
|
81
|
+
writeCacheJson(filePath, Object.fromEntries(observed));
|
|
82
|
+
else
|
|
83
|
+
fs.rmSync(filePath, { force: true });
|
|
84
|
+
};
|
|
85
|
+
// 普通缓存仅保存未采用参考的摘要,供下次按 key 比较变化,不保存参考原文。
|
|
86
|
+
export const referenceDigest = (snapshot) => createHash("sha256").update(JSON.stringify(Object.entries(snapshot).sort())).digest("hex");
|
|
87
|
+
export const getRejectedReferences = (cache) => {
|
|
88
|
+
const metadata = cache._meta;
|
|
89
|
+
const rejected = metadata && typeof metadata === "object" ? metadata.rejectedReferences : undefined;
|
|
90
|
+
return Object.assign(Object.create(null), rejected);
|
|
91
|
+
};
|
|
92
|
+
export const getMissingReferenceIds = (cache) => {
|
|
93
|
+
const metadata = cache._meta;
|
|
94
|
+
const missing = metadata && typeof metadata === "object" ? metadata.missingReferenceIds : undefined;
|
|
95
|
+
return Object.assign(Object.create(null), missing);
|
|
96
|
+
};
|
|
97
|
+
const setSourceCacheMetadata = (cache, rejected, missing) => {
|
|
98
|
+
const metadata = Object.assign(Object.assign({}, (Object.keys(rejected).length ? { rejectedReferences: rejected } : {})), (Object.keys(missing).length ? { missingReferenceIds: missing } : {}));
|
|
99
|
+
if (Object.keys(metadata).length)
|
|
100
|
+
cache._meta = metadata;
|
|
101
|
+
else
|
|
102
|
+
delete cache._meta;
|
|
103
|
+
};
|
|
104
|
+
export const writeMissingReferenceIds = (filePath, updates) => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
|
+
const cache = yield getCacheFileSync(filePath);
|
|
106
|
+
setSourceCacheMetadata(cache, getRejectedReferences(cache), Object.assign(Object.assign({}, getMissingReferenceIds(cache)), updates));
|
|
107
|
+
writeCacheJson(filePath, cache);
|
|
108
|
+
});
|
|
65
109
|
/**
|
|
66
110
|
* 注册语言缓存文件
|
|
67
111
|
* @param {string} language
|
|
68
112
|
*/
|
|
69
113
|
export const registerLanguageCacheFile = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
var _a;
|
|
70
115
|
const { jsonMap, sourceFilePath, fileName, language, folderName } = params;
|
|
71
116
|
const cacheFilePath = path.join(folderName, language, fileName);
|
|
72
117
|
const sourceObject = yield readJsonFileSync(sourceFilePath);
|
|
73
|
-
const cacheObject = yield
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
118
|
+
const cacheObject = yield getCacheFileSync(cacheFilePath);
|
|
119
|
+
const rejectedReferences = getRejectedReferences(cacheObject);
|
|
120
|
+
const missingReferenceIds = getMissingReferenceIds(cacheObject);
|
|
121
|
+
for (const key of Object.keys(jsonMap)) {
|
|
122
|
+
if (key === "_meta")
|
|
123
|
+
continue;
|
|
124
|
+
cacheObject[key] = sourceObject[key];
|
|
125
|
+
const digest = (_a = params.rejectedReferences) === null || _a === void 0 ? void 0 : _a[key];
|
|
126
|
+
if (digest)
|
|
127
|
+
rejectedReferences[key] = digest;
|
|
128
|
+
else
|
|
129
|
+
delete rejectedReferences[key];
|
|
130
|
+
if (params.usedReferenceId && missingReferenceIds[key]) {
|
|
131
|
+
const remaining = missingReferenceIds[key].filter((id) => id !== params.usedReferenceId);
|
|
132
|
+
if (remaining.length)
|
|
133
|
+
missingReferenceIds[key] = remaining;
|
|
134
|
+
else
|
|
135
|
+
delete missingReferenceIds[key];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
setSourceCacheMetadata(cacheObject, rejectedReferences, missingReferenceIds);
|
|
79
139
|
if (Object.values(jsonMap).length === 0)
|
|
80
140
|
return;
|
|
81
141
|
notExistsToCreateFile(folderName);
|
|
@@ -170,9 +230,14 @@ export const deleteBatchCache = (params) => {
|
|
|
170
230
|
deleteLanguages.forEach((language) => {
|
|
171
231
|
const jsonData = fs.readFileSync(path.resolve(cacheFolderPath, language, cacheFileName), "utf-8");
|
|
172
232
|
const data = JSON.parse(jsonData);
|
|
233
|
+
const rejectedReferences = getRejectedReferences(data);
|
|
234
|
+
const missingReferenceIds = getMissingReferenceIds(data);
|
|
173
235
|
keys.forEach((key) => {
|
|
174
236
|
delete data[key];
|
|
237
|
+
delete rejectedReferences[key];
|
|
238
|
+
delete missingReferenceIds[key];
|
|
175
239
|
});
|
|
240
|
+
setSourceCacheMetadata(data, rejectedReferences, missingReferenceIds);
|
|
176
241
|
fs.writeFileSync(path.resolve(cacheFolderPath, language, cacheFileName), JSON.stringify(data, null, 2), "utf-8");
|
|
177
242
|
});
|
|
178
243
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation-format.d.ts","sourceRoot":"","sources":["../src/lib/translation-format.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM;UACvB,MAAM;iBAAe,OAAO;IAwBrD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// 支持 i18next 插值、React Intl 参数、富文本标签和常见 printf 占位符。
|
|
2
|
+
const formatStart = /[%$]?\{|<\/?[\p{L}\p{N}_][\p{L}\p{N}_.:-]*(?:\s+(?:"[^"]*"|'[^']*'|[^<>"'])*)?\s*\/?>|%(?:\d+\$|\([\p{L}\p{N}_.-]+\))?[sdif@](?![\p{L}\p{N}_])/gu;
|
|
3
|
+
const argumentStart = /^\{(?:\{\s*-?)?\s*[\p{L}\p{N}_][\p{L}\p{N}_.-]*\s*(?=[,}])/u;
|
|
4
|
+
export function splitTranslationText(text) {
|
|
5
|
+
const segments = [];
|
|
6
|
+
let offset = 0;
|
|
7
|
+
for (const match of text.matchAll(formatStart)) {
|
|
8
|
+
const start = match.index;
|
|
9
|
+
if (start < offset)
|
|
10
|
+
continue;
|
|
11
|
+
let end = start + match[0].length;
|
|
12
|
+
if (match[0].endsWith("{")) {
|
|
13
|
+
if (!argumentStart.test(text.slice(end - 1)))
|
|
14
|
+
continue;
|
|
15
|
+
let depth = 1;
|
|
16
|
+
while (end < text.length && depth) {
|
|
17
|
+
const char = text[end++];
|
|
18
|
+
if (char === "{")
|
|
19
|
+
depth++;
|
|
20
|
+
else if (char === "}")
|
|
21
|
+
depth--;
|
|
22
|
+
}
|
|
23
|
+
if (depth)
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
segments.push({ text: text.slice(offset, start), placeholder: false }, { text: text.slice(start, end), placeholder: true });
|
|
27
|
+
offset = end;
|
|
28
|
+
}
|
|
29
|
+
segments.push({ text: text.slice(offset), placeholder: false });
|
|
30
|
+
return segments;
|
|
31
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { FileTranslationMetadata } from "../types/index.js";
|
|
2
2
|
export declare const readProtectedTerms: (value: unknown) => readonly string[] | undefined;
|
|
3
3
|
export declare const readTranslationMetadata: (value: unknown) => FileTranslationMetadata | undefined;
|
|
4
|
-
export declare const protectTerms: (text: string, localTerms?: readonly string[], globalTerms?: readonly string[]) => {
|
|
4
|
+
export declare const protectTerms: (text: string, localTerms?: readonly string[], globalTerms?: readonly string[], sourceLiterals?: (text: string) => {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
}[]) => {
|
|
5
8
|
text: string;
|
|
6
9
|
restore(translation: string): string;
|
|
7
10
|
} | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation-metadata.d.ts","sourceRoot":"","sources":["../src/lib/translation-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"translation-metadata.d.ts","sourceRoot":"","sources":["../src/lib/translation-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAGjE,eAAO,MAAM,kBAAkB,UAAW,OAAO,KAAG,SAAS,MAAM,EAAE,GAAG,SAQvE,CAAC;AAEF,eAAO,MAAM,uBAAuB,UAAW,OAAO,KAAG,uBAAuB,GAAG,SASlF,CAAC;AAcF,eAAO,MAAM,YAAY,SACjB,MAAM,eACC,SAAS,MAAM,EAAE,gBAChB,SAAS,MAAM,EAAE,mBACd,CAAC,IAAI,EAAE,MAAM,KAAK;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE;;yBA8C5C,MAAM;aAW9B,CAAC;AAEF,eAAO,MAAM,eAAe,SACpB,MAAM,eACC,SAAS,MAAM,EAAE,gBAChB,SAAS,MAAM,EAAE,YAKhC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { splitTranslationText } from "./translation-format.js";
|
|
1
2
|
export const readProtectedTerms = (value) => {
|
|
2
3
|
if (Array.isArray(value) &&
|
|
3
4
|
value.length > 0 &&
|
|
@@ -15,36 +16,64 @@ export const readTranslationMetadata = (value) => {
|
|
|
15
16
|
return { context: fileContext || undefined, noTranslate: protectedTerms };
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
-
if (!(
|
|
19
|
+
const protectedTermPattern = (terms) => {
|
|
20
|
+
if (!(terms === null || terms === void 0 ? void 0 : terms.length))
|
|
21
|
+
return;
|
|
22
|
+
const alternatives = [...terms]
|
|
23
|
+
.sort((first, second) => second.length - first.length)
|
|
24
|
+
.map((term) => term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
25
|
+
const wordCharacters = "[\\p{L}\\p{M}\\p{N}_]";
|
|
26
|
+
return new RegExp(`(?<!${wordCharacters})(?:${alternatives.join("|")})(?!${wordCharacters})`, "gu");
|
|
27
|
+
};
|
|
28
|
+
export const protectTerms = (text, localTerms, globalTerms, sourceLiterals) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const localPattern = protectedTermPattern(localTerms);
|
|
31
|
+
const globalPattern = protectedTermPattern(globalTerms);
|
|
32
|
+
if (!localPattern && !globalPattern && !sourceLiterals)
|
|
20
33
|
return;
|
|
21
34
|
let prefix = "{__CC_PROTECTED_";
|
|
22
35
|
while (text.includes(prefix))
|
|
23
36
|
prefix += "_";
|
|
24
37
|
const placeholders = new Map();
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
if (!(terms === null || terms === void 0 ? void 0 : terms.length))
|
|
38
|
+
const segments = splitTranslationText(text);
|
|
39
|
+
for (const segment of segments) {
|
|
40
|
+
if (segment.placeholder)
|
|
29
41
|
continue;
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
const matches = (_a = sourceLiterals === null || sourceLiterals === void 0 ? void 0 : sourceLiterals(segment.text)) !== null && _a !== void 0 ? _a : [];
|
|
43
|
+
// 先匹配局部词,再匹配全局词。两次都使用原文,避免占位符改变词边界。
|
|
44
|
+
for (const pattern of [localPattern, globalPattern]) {
|
|
45
|
+
if (!pattern)
|
|
46
|
+
continue;
|
|
47
|
+
for (const match of segment.text.matchAll(pattern)) {
|
|
48
|
+
matches.push({ start: match.index, end: match.index + match[0].length });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
matches.sort((first, second) => first.start - second.start);
|
|
52
|
+
// 包含或重叠的匹配合并成一个范围,独立的匹配各自保留。
|
|
53
|
+
const merged = [];
|
|
54
|
+
for (const match of matches) {
|
|
55
|
+
const previous = merged[merged.length - 1];
|
|
56
|
+
if (previous && match.start < previous.end) {
|
|
57
|
+
previous.end = Math.max(previous.end, match.end);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
merged.push(match);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
let offset = 0;
|
|
64
|
+
let masked = "";
|
|
65
|
+
for (const { start, end } of merged) {
|
|
66
|
+
const placeholder = `${prefix}${placeholders.size}__}`;
|
|
67
|
+
placeholders.set(placeholder, segment.text.slice(start, end));
|
|
68
|
+
masked += segment.text.slice(offset, start) + placeholder;
|
|
69
|
+
offset = end;
|
|
41
70
|
}
|
|
42
|
-
|
|
71
|
+
segment.text = masked + segment.text.slice(offset);
|
|
43
72
|
}
|
|
44
73
|
if (placeholders.size === 0)
|
|
45
74
|
return;
|
|
46
75
|
return {
|
|
47
|
-
text:
|
|
76
|
+
text: segments.map(({ text }) => text).join(""),
|
|
48
77
|
restore(translation) {
|
|
49
78
|
for (const [placeholder, term] of placeholders) {
|
|
50
79
|
const parts = translation.split(placeholder);
|
|
@@ -61,7 +90,5 @@ export const isProtectedText = (text, localTerms, globalTerms) => {
|
|
|
61
90
|
if (!(localTerms === null || localTerms === void 0 ? void 0 : localTerms.length) && !(globalTerms === null || globalTerms === void 0 ? void 0 : globalTerms.length))
|
|
62
91
|
return false;
|
|
63
92
|
const value = text.trim();
|
|
64
|
-
|
|
65
|
-
return true;
|
|
66
|
-
return Boolean((globalTerms === null || globalTerms === void 0 ? void 0 : globalTerms.includes(value)) && !protectTerms(value, localTerms));
|
|
93
|
+
return Boolean((localTerms === null || localTerms === void 0 ? void 0 : localTerms.includes(value)) || (globalTerms === null || globalTerms === void 0 ? void 0 : globalTerms.includes(value)));
|
|
67
94
|
};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import type { SupportLanguageType, TranslationReference } from "../types/index.js";
|
|
1
2
|
export declare function readTranslationResponse(content: string | null | undefined, source: string): string;
|
|
3
|
+
export declare const englishSourceLiterals: (text: string) => {
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
}[];
|
|
7
|
+
export declare function isNonEnglishSource(source: string): boolean;
|
|
8
|
+
export declare function hasUnexpectedTranslationLanguage(translation: string, source: TranslationReference, targetLanguage: SupportLanguageType, references: readonly TranslationReference[]): boolean;
|
|
2
9
|
//# sourceMappingURL=translation-response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation-response.d.ts","sourceRoot":"","sources":["../src/lib/translation-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translation-response.d.ts","sourceRoot":"","sources":["../src/lib/translation-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAYnF,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAClC,MAAM,EAAE,MAAM,GACb,MAAM,CA6CR;AA0ED,eAAO,MAAM,qBAAqB,SAAU,MAAM;WA3BzB,MAAM;SAAO,MAAM;GAgC3C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAO1D;AAED,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,oBAAoB,EAC5B,cAAc,EAAE,mBAAmB,EACnC,UAAU,EAAE,SAAS,oBAAoB,EAAE,GAC1C,OAAO,CA2BT"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { detectAll } from "tinyld";
|
|
2
|
+
import { splitTranslationText } from "./translation-format.js";
|
|
1
3
|
const codeFence = /^\x60{3}(?:json|text|plaintext)?[ \t]*\r?\n([\s\S]*?)\r?\n\x60{3}$/i;
|
|
2
4
|
const structuredPrefix = /^\{\s*["'}]|^\[\s*["{\[\]]/;
|
|
3
5
|
const responseLabel = /(?:^|\r?\n)\s*(?:\*{1,2})?(?:source|target|translation|translated text)(?:\*{1,2})?\s*:/i;
|
|
@@ -45,3 +47,123 @@ export function readTranslationResponse(content, source) {
|
|
|
45
47
|
}
|
|
46
48
|
return text;
|
|
47
49
|
}
|
|
50
|
+
const latin = /\p{Script_Extensions=Latin}/u;
|
|
51
|
+
const arabic = /\p{Script_Extensions=Arabic}/u;
|
|
52
|
+
const han = /\p{Script_Extensions=Han}/u;
|
|
53
|
+
const cyrillic = /\p{Script_Extensions=Cyrillic}/u;
|
|
54
|
+
const devanagari = /\p{Script_Extensions=Devanagari}/u;
|
|
55
|
+
const languageScripts = {
|
|
56
|
+
ar: arabic,
|
|
57
|
+
fa: arabic,
|
|
58
|
+
"ur-PK": arabic,
|
|
59
|
+
"zh-CN": han,
|
|
60
|
+
"zh-TW": han,
|
|
61
|
+
ja: /[\p{Script_Extensions=Han}\p{Script_Extensions=Hiragana}\p{Script_Extensions=Katakana}]/u,
|
|
62
|
+
ko: /[\p{Script_Extensions=Hangul}\p{Script_Extensions=Han}]/u,
|
|
63
|
+
ru: cyrillic,
|
|
64
|
+
uk: cyrillic,
|
|
65
|
+
hi: devanagari,
|
|
66
|
+
"ne-NP": devanagari,
|
|
67
|
+
bn: /\p{Script_Extensions=Bengali}/u,
|
|
68
|
+
my: /\p{Script_Extensions=Myanmar}/u,
|
|
69
|
+
"th-TH": /\p{Script_Extensions=Thai}/u,
|
|
70
|
+
};
|
|
71
|
+
const notation = /(?<!\p{L})(?:[ΔδπΩΣσλθ]|[µμ](?:m|s|g|A|F|L|V|W|mol))(?!\p{L})/gu;
|
|
72
|
+
const sentences = /[^.!?。!?\r\n]+/gu;
|
|
73
|
+
const stripNotation = (text) => text.replace(notation, (value) => " ".repeat(value.length));
|
|
74
|
+
const visibleText = (text) => splitTranslationText(text)
|
|
75
|
+
.map((segment) => segment.placeholder ? " ".repeat(segment.text.length) : segment.text)
|
|
76
|
+
.join("");
|
|
77
|
+
const comparableText = (text) => visibleText(text).normalize("NFKC").toLowerCase().replace(/[\p{P}\p{S}\s]/gu, "");
|
|
78
|
+
const detectConfidentLanguage = (text) => {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
const words = (_a = text.match(/\p{L}+/gu)) !== null && _a !== void 0 ? _a : [];
|
|
81
|
+
// 短词和品牌名可能跨语言共用,只在文案足够长且识别结果明显时拦截。
|
|
82
|
+
if (words.length < 3 || words.join("").length < 16)
|
|
83
|
+
return;
|
|
84
|
+
const [first, second] = detectAll(text);
|
|
85
|
+
if (!first)
|
|
86
|
+
return;
|
|
87
|
+
const runnerUp = (_b = second === null || second === void 0 ? void 0 : second.accuracy) !== null && _b !== void 0 ? _b : 0;
|
|
88
|
+
if (first.accuracy >= 0.65 && first.accuracy - runnerUp >= 0.25)
|
|
89
|
+
return first.lang;
|
|
90
|
+
// 对完整长句,再参考候选语言之间的相对差距,避免漏放低原始分但明显领先的文案。
|
|
91
|
+
if (words.length >= 6 && first.accuracy >= 0.04 && first.accuracy >= 2 * runnerUp)
|
|
92
|
+
return first.lang;
|
|
93
|
+
};
|
|
94
|
+
const foreignRanges = (text) => {
|
|
95
|
+
var _a;
|
|
96
|
+
const ranges = [];
|
|
97
|
+
const plain = stripNotation(text);
|
|
98
|
+
for (const match of plain.matchAll(sentences)) {
|
|
99
|
+
const sentence = match[0];
|
|
100
|
+
const letters = (_a = sentence.match(/\p{L}/gu)) !== null && _a !== void 0 ? _a : [];
|
|
101
|
+
if (letters.some((letter) => !latin.test(letter))) {
|
|
102
|
+
for (const letter of sentence.matchAll(/\p{L}\p{M}*/gu)) {
|
|
103
|
+
if (latin.test(letter[0]))
|
|
104
|
+
continue;
|
|
105
|
+
const start = match.index + letter.index;
|
|
106
|
+
const end = start + letter[0].length;
|
|
107
|
+
const previous = ranges[ranges.length - 1];
|
|
108
|
+
if (previous && /^\s*$/u.test(plain.slice(previous.end, start)))
|
|
109
|
+
previous.end = end;
|
|
110
|
+
else
|
|
111
|
+
ranges.push({ start, end });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const detected = detectConfidentLanguage(sentence);
|
|
116
|
+
if (detected && detected !== "en") {
|
|
117
|
+
ranges.push({
|
|
118
|
+
start: match.index + sentence.length - sentence.trimStart().length,
|
|
119
|
+
end: match.index + sentence.trimEnd().length,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return ranges;
|
|
125
|
+
};
|
|
126
|
+
export const englishSourceLiterals = (text) => [
|
|
127
|
+
...foreignRanges(text),
|
|
128
|
+
...Array.from(text.matchAll(notation), (match) => ({
|
|
129
|
+
start: match.index, end: match.index + match[0].length,
|
|
130
|
+
})),
|
|
131
|
+
];
|
|
132
|
+
export function isNonEnglishSource(source) {
|
|
133
|
+
const text = stripNotation(visibleText(source));
|
|
134
|
+
const ranges = foreignRanges(text);
|
|
135
|
+
if (!ranges.length)
|
|
136
|
+
return false;
|
|
137
|
+
const remainder = text.split("");
|
|
138
|
+
for (const { start, end } of ranges)
|
|
139
|
+
remainder.fill(" ", start, end);
|
|
140
|
+
return !/\p{L}/u.test(remainder.join(""));
|
|
141
|
+
}
|
|
142
|
+
export function hasUnexpectedTranslationLanguage(translation, source, targetLanguage, references) {
|
|
143
|
+
var _a, _b, _c;
|
|
144
|
+
const visible = stripNotation(visibleText(translation));
|
|
145
|
+
const letters = (_a = visible.match(/\p{L}/gu)) !== null && _a !== void 0 ? _a : [];
|
|
146
|
+
if (!letters.length)
|
|
147
|
+
return false;
|
|
148
|
+
const normalized = comparableText(translation);
|
|
149
|
+
if (normalized === comparableText(source.value))
|
|
150
|
+
return false;
|
|
151
|
+
const acceptedLanguages = [source.language.split("-")[0], targetLanguage.split("-")[0]];
|
|
152
|
+
// 不同语言可能共用同一种文字。除了检查文字,还要拦截原样返回的其他语言参考。
|
|
153
|
+
if (references.some(({ language, value }) => !acceptedLanguages.includes(language.split("-")[0]) && comparableText(value) === normalized))
|
|
154
|
+
return true;
|
|
155
|
+
const sourceScript = (_b = languageScripts[source.language]) !== null && _b !== void 0 ? _b : latin;
|
|
156
|
+
const targetScript = (_c = languageScripts[targetLanguage]) !== null && _c !== void 0 ? _c : latin;
|
|
157
|
+
if (letters.some((letter) => !sourceScript.test(letter) && !targetScript.test(letter)))
|
|
158
|
+
return true;
|
|
159
|
+
for (const [sentence] of visible.matchAll(sentences)) {
|
|
160
|
+
const detected = detectConfidentLanguage(sentence);
|
|
161
|
+
if (!detected || acceptedLanguages.includes(detected))
|
|
162
|
+
continue;
|
|
163
|
+
// 这些语种容易被识别器混淆。文字系统相容时,不能仅凭此结果拒绝合法译文。
|
|
164
|
+
const confusable = [["ms", "id"], ["ne", "hi"]].some((group) => group.includes(detected) && acceptedLanguages.some((language) => group.includes(language)));
|
|
165
|
+
if (!confusable)
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-translate",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "A language translation tool based on OpenAI",
|
|
5
5
|
"author": "maybe",
|
|
6
6
|
"license": "ISC",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"ansi-colors": "^4.1.3",
|
|
52
52
|
"cli-progress": "^3.12.0",
|
|
53
|
-
"openai": "^4.68.1"
|
|
53
|
+
"openai": "^4.68.1",
|
|
54
|
+
"tinyld": "^1.3.4"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@types/cli-progress": "^3.11.6",
|
package/types/index.d.ts
CHANGED
|
@@ -28,29 +28,43 @@ export interface IOutputLanguageFile {
|
|
|
28
28
|
fileName: string;
|
|
29
29
|
jsonMap: IJson;
|
|
30
30
|
blockedKeys?: ReadonlySet<string>;
|
|
31
|
+
rejectedReferences?: IJson;
|
|
32
|
+
usedReferenceId?: string;
|
|
31
33
|
}
|
|
32
34
|
export interface IRegisterLanguageCacheFile {
|
|
33
35
|
folderName: string;
|
|
34
36
|
fileName: string;
|
|
35
37
|
language: SupportLanguageType;
|
|
36
38
|
jsonMap: IJson;
|
|
39
|
+
rejectedReferences?: IJson;
|
|
40
|
+
usedReferenceId?: string;
|
|
37
41
|
/** await translate file path */
|
|
38
42
|
sourceFilePath: string;
|
|
39
43
|
}
|
|
40
44
|
export interface IJson {
|
|
41
45
|
[key: string]: string;
|
|
42
46
|
}
|
|
43
|
-
export type ReferenceSnapshot = Record<string, string
|
|
47
|
+
export type ReferenceSnapshot = Record<string, string>;
|
|
48
|
+
export type MissingReferenceIds = Record<string, string[]>;
|
|
49
|
+
export type SourceCache = Record<string, string | {
|
|
50
|
+
rejectedReferences?: IJson;
|
|
51
|
+
missingReferenceIds?: MissingReferenceIds;
|
|
52
|
+
}>;
|
|
44
53
|
export interface ReferenceCacheState {
|
|
45
54
|
filePath: string;
|
|
55
|
+
rejectedReferences: IJson;
|
|
46
56
|
observed: Map<string, ReferenceSnapshot>;
|
|
47
57
|
current: ReadonlyMap<string, ReferenceSnapshot>;
|
|
58
|
+
changed: Map<string, {
|
|
59
|
+
identity: string;
|
|
60
|
+
value: string;
|
|
61
|
+
}>;
|
|
48
62
|
}
|
|
49
63
|
export interface FileTranslationMetadata {
|
|
50
64
|
context?: string;
|
|
51
65
|
noTranslate?: readonly string[];
|
|
52
66
|
}
|
|
53
|
-
interface TranslationReference {
|
|
67
|
+
export interface TranslationReference {
|
|
54
68
|
language: SupportLanguageType;
|
|
55
69
|
value: string;
|
|
56
70
|
}
|
|
@@ -68,8 +82,8 @@ export interface ISingleTranslate {
|
|
|
68
82
|
progressBar?: SingleBar;
|
|
69
83
|
callback?: () => void;
|
|
70
84
|
reference?: FileTranslationReference;
|
|
71
|
-
references?: readonly FileTranslationReference[];
|
|
72
85
|
blockedKeys?: ReadonlySet<string>;
|
|
86
|
+
conflictingKeys?: ReadonlySet<string>;
|
|
73
87
|
metadata?: FileTranslationMetadata;
|
|
74
88
|
referenceCache?: ReferenceCacheState;
|
|
75
89
|
}
|
|
@@ -80,13 +94,15 @@ export interface ITranslateChat {
|
|
|
80
94
|
index: number;
|
|
81
95
|
fileName: string;
|
|
82
96
|
reference?: TranslationReference;
|
|
83
|
-
references?: readonly TranslationReference[];
|
|
84
97
|
metadata?: FileTranslationMetadata;
|
|
98
|
+
changedReference?: string;
|
|
99
|
+
sourceOnly?: boolean;
|
|
85
100
|
}
|
|
86
101
|
export interface ITranslateChatResponse {
|
|
87
102
|
key: string;
|
|
88
103
|
value: string;
|
|
89
104
|
index: number;
|
|
105
|
+
usedSourceFallback?: boolean;
|
|
90
106
|
error?: Error;
|
|
91
107
|
}
|
|
92
108
|
export interface II18nTranslateAgentParams {
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACnD,OA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