forked from plugCubed/plugCubed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_cleanLang.js
43 lines (40 loc) · 1.46 KB
/
_cleanLang.js
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
var fs = require('fs');
// Release
fs.readdir('src/release/langs', function(err, files) {
if (err) console.log('Error cleaning language files', err);
for (var i in files) {
if (!files.hasOwnProperty(i)) continue;
var path = 'src/release/langs/' + files[i];
if (path.substr(-5) === '.json') {
fs.writeFileSync(path, fs.readFileSync(path, 'utf8').split("\\'").join("'"));
}
}
});
// Alpha
fs.readdir('src/alpha/langs', function(err, files) {
if (err) console.log('Error cleaning language files', err);
var langs = [];
for (var i in files) {
if (!files.hasOwnProperty(i)) continue;
var path = 'src/alpha/langs/' + files[i];
if (path.substr(-5) === '.json') {
langs.push(path.split('.')[1]);
fs.writeFileSync(path, fs.readFileSync(path, 'utf8').split("\\'").join("'"));
}
}
fs.writeFileSync('src/dev/lang.json', JSON.stringify(langs));
});
// Dev
fs.readdir('src/dev/langs', function(err, files) {
if (err) console.log('Error cleaning language files', err);
var langs = [];
for (var i in files) {
if (!files.hasOwnProperty(i)) continue;
var path = 'src/dev/langs/' + files[i];
if (path.substr(-5) === '.json') {
langs.push(path.split('.')[1]);
fs.writeFileSync(path, fs.readFileSync(path, 'utf8').split("\\'").join("'"));
}
}
fs.writeFileSync('src/dev/lang.json', JSON.stringify(langs));
});