mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
14 lines
449 B
JavaScript
14 lines
449 B
JavaScript
const yaml = require('js-yaml');
|
|
const fs = require('fs');
|
|
const root = require('./root');
|
|
const build = async () => {
|
|
let langs = fs.readdirSync(root('locales'));
|
|
let lang = {};
|
|
for (let i of langs) {
|
|
const content = fs.readFileSync(root(`locales/${i}`)).toString();
|
|
lang[i.split('.')[0]] = yaml.safeLoad(content);
|
|
}
|
|
fs.writeFileSync(root('.build/locales.json'), JSON.stringify(lang));
|
|
}
|
|
module.exports = build;
|