-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathgulpfile.js
31 lines (30 loc) · 998 Bytes
/
gulpfile.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
/**
* Translate Chinese json files into other language json files
* language : https://cloud.google.com/translate/docs/languages
*/
const gulp = require('gulp'),
i18n = require('./i18n/config'),
// languges = require('./i18n/languges'),
languges = require('./i18n/languges_conf'),
rename = require('gulp-rename');
// The task of translating files
gulp.task('default', function () {
for (const languge in languges) {
// console.log(languge,languges[languge])
gulp.src('./i18n/tap-i18n.json')
.pipe(
// The specific logic of translation
i18n('', languge)
)
.pipe(rename({
dirname: "i18n",
basename: languge,
extname: ".json"
}))
// Post-translation file output file path
.pipe(gulp.dest('./src/renderer/'));
}
});
gulp.task('watch', function () {
gulp.watch('i18n/tap-i18n.json', ['default']);
})