-
Notifications
You must be signed in to change notification settings - Fork 0
/
diff.html
44 lines (41 loc) · 1.54 KB
/
diff.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!-- 开发时检查两个文件字段名是否有纰漏 ---- 翻译审查工具---- -->
<!-- 本文件可直接删除 -->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Execute Code</title>
</head>
<body>
<button id="executeButton">开始执行</button>
<script>
document
.getElementById("executeButton")
.addEventListener("click", function () {
// 注意改成js模式 因为是module导出typeScript会报错
import("./en.js").then(({ default: en }) => {
import("./zh.js").then(({ default: zh }) => {
const enKeys = Object.keys(en);
const zhKeys = Object.keys(zh);
const differentKeys = enKeys
.filter((key) => !zhKeys.includes(key))
.concat(zhKeys.filter((key) => !enKeys.includes(key)));
const enDifferent = Object.fromEntries(
Object.entries(en).filter(([key]) =>
differentKeys.includes(key),
),
);
const zhDifferent = Object.fromEntries(
Object.entries(zh).filter(([key]) =>
differentKeys.includes(key),
),
);
console.log("enDifferent:", enDifferent); // en.js 对比结果不同项
console.log("zhDifferent:", zhDifferent); // zh.js 对比结果不同项
});
});
});
</script>
</body>
</html>