Closed dillonbailey closed 6 years ago
This should work:
var gulp = require('gulp'),
data = require('gulp-data'),
template = require('gulp-nunjucks-render'),
I18nExtension = require("nunjucks-i18n")(require('gulp-nunjucks-render').nunjucks);
var manageEnvironment = function(environment) {
environment.addExtension('I18nExtension', new I18nExtension({
env: environment,
translations: {
fr: {
HELLOWORLD: "Bonjour"
}
}
}));
};
gulp.task('template', function() {
var context={
__locale__ : "fr"
};
gulp.src(src)
.pipe(data(context))
.pipe(template({
manageEnv: manageEnvironment,
}))
.pipe(dist);
});
When attempting to add this extension to the environment the block tag i18n resulted in this error: