Commit df1fc6b9 authored by dragondean@qq.com's avatar dragondean@qq.com

完善collectIon8nMesages.js

parent 767a9c65
const fs = require('fs');
const root = "./src"
const savePath = "./i18n-messages.txt"
const savePath = "./src/i18n/languages/en_US.json"
let allFiles = []
function getFiles(dir){
......@@ -29,6 +29,12 @@ allFiles.forEach(file => {
messages.add(item[1])
}
})
fs.writeFileSync("./i18n-messages.txt", Array.from(messages).join("\n"))
let obj = require(savePath)
Array.from(messages).forEach(word => {
if(!obj[word])obj[word] = ""
})
fs.writeFileSync(savePath, JSON.stringify(obj, null, 4))
console.log(messages)
console.warn(`共提取 ${messages.size} 个待翻译内容,保存于${savePath}`)
\ No newline at end of file
console.warn(`本次共提取 ${messages.size} 个待翻译内容,保存于${savePath}`)
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment