Extract and compile translatable strings using angular-gettext
Modernized fork of gulp-angular-gettext, built on @recranet/angular-gettext-tools. The public API is unchanged.
- Node.js 22 or newer.
The only runtime dependency is @recranet/angular-gettext-tools; the gulp plumbing uses the built-in node:stream module.
npm install --save-dev github:recranet/gulp-angular-gettextvar gulp = require('gulp');
var gettext = require('@recranet/gulp-angular-gettext');
gulp.task('pot', function () {
return gulp.src(['src/partials/**/*.html', 'src/scripts/**/*.js'])
.pipe(gettext.extract('template.pot', {
// options to pass to angular-gettext-tools...
}))
.pipe(gulp.dest('po/'));
});
gulp.task('translations', function () {
return gulp.src('po/**/*.po')
.pipe(gettext.compile({
// options to pass to angular-gettext-tools...
format: 'json'
}))
.pipe(gulp.dest('dist/translations/'));
});out- an optional String representing the name of the POT file to output. If this option is given, a single POT file will be generated for the entire set of input files. If this option is omitted, one POT file will be generated per input file.options- an optional object to pass to angular-gettext-toolsExtractor
options- an optional object to pass to angular-gettext-toolsCompiler