gulp-translate-html

0.0.2 • Public • Published

gulp-translate-html

Build Status

translate-html plugin for gulp

Usage

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"));

API

translate-html(options)

options.messages

Type: Object

Your Messages Object.

License

MIT License

Readme

Keywords

Package Sidebar

Install

npm i gulp-translate-html

Weekly Downloads

124

Version

0.0.2

License

MIT

Last publish

Collaborators

  • hakashun