// by default, the locale is written to the stream as `en.json`
nativeLocale:'en',
// NEW: Create Chrome-like nested JSON with metadata and tags
nested:false
}))
localize()
Localizes files for each locale in locales. Localized files are nested in a subdirectory for each locale. The nativeLocale and locales options are required.
var gulp =require('gulp');
var l10n =require('gulp-l10n-toolkit');
gulp.task('localize',function(){
returngulp.src('src/**/*.html')
.pipe(l10n.localize({
nativeLocale:'locales/en.json',
locales:'locales/*.json'
}))
.pipe(gulp.dest('dist'));
});
gulp.task('default',['localize']);
options
.pipe(l10n.localize({
// Required: glob of locales to use in localizing files
locales:'locales/*.json',
// Required: path of nativeLocale file
nativeLocale:'locales/en.json'
}))
simulateTranslation()
This is a utility to quickly simulate translation of the native locale to a list of locales.
var gulp =require('gulp');
var l10n =require('gulp-l10n-toolkit');
gulp.task('simulate-translations',function(){
returngulp.src('locales/en.json')
.pipe(l10n.simulateTranslation())
.pipe(gulp.dest('locales'));
});
options
.pipe(l10n.simulateTranslation({
// dictionary of strings and string replacements, e.g.:
// before: 'This is <a href="/">a test</a> string.'