translate-html plugin for gulp
First, install gulp-translate-html
as a development dependency:
npm install --save-dev gulp-translate-html
Then, add it to your gulpfile.js
:
var translate-html = require("gulp-translate-html");
gulp.src("./src/*.html")
.pipe(translate-html({
messages: {
"name": "Taro Yamada"
}
}))
.pipe(gulp.dest("./dist"));
var translate-html = require("gulp-translate-html");
gulp.src("./src/*.html")
.pipe(translate-html({
messages: require('./locale/ja.json')
}))
.pipe(gulp.dest("./dist"));
You can change the template settings to use alternative delimiters by use of https://lodash.com/docs#templateSettings.
var translate-html = require("gulp-translate-html");
gulp.src("./src/*.html")
.pipe(translate-html({
messages: require('./locale/ja.json'),
templateSettings: {
interpolate: /{{([\s\S]+?)}}/g
}
}))
.pipe(gulp.dest("./dist"));
Type: Object
Your Messages Object.