22 lines
876 B
Plaintext
22 lines
876 B
Plaintext
按照此伪代码编写一个Node.js脚本,要求:
|
||
1. 尽量不使用第三方库
|
||
2. 使用双引号代替单引号
|
||
3. 使用引号
|
||
|
||
伪代码:
|
||
遍历读取 ./mods/*.jar (*.jar等同于*.zip压缩包) {
|
||
const modId = JSON.parse(读取 *.jar/fabric.mod.json).id;
|
||
const enLang = JSON.parse(读取 `*.jar/assets/${modId}/lang/en_us.json`);
|
||
const zhLang = () => {'
|
||
if (存在 `*.jar/assets/${modId}/lang/zh_cn.json`) {
|
||
return JSON.parse(读取 `*.jar/assets/${modId}/lang/zh_cn.json`)
|
||
} else if (存在 `./i18n/${modId}/lang/zh_cn.json`){
|
||
return JSON.parse(读取 `./i18n/${modId}/lang/zh_cn.json`)
|
||
}
|
||
return {};
|
||
};
|
||
|
||
if (有存在于 enLang 中但不存在于 zhLang 中的 key){
|
||
写入文件`./lang/zh_cn/${modId}.json` (内容: 格式化为人易读的格式(zhLang))
|
||
}
|
||
} |