Strings are not extracted from es6 modules
ekaragodin opened this issue · 2 comments
ekaragodin commented
import angular from 'angular';
angular.controller('GreetingController', function(gettextCatalog) {
this.message = gettextCatalog.getString("Hello");
});
ramonsan commented
Seems that angular-gettext does not support ES6, but you can transform into ES5 with babel, and then extract strings.
For example, I use gulp to do that:
var babel = require('gulp-babel');
var plumber = require('gulp-plumber');
var gettext = require('gulp-angular-gettext');
gulp.task('extract-strings', function (done) {
gulp.src(['src/**/*.js'])
.pipe(plumber())
.pipe(babel({ presets: ['es2015'] }))
.pipe(gulp.src(['src/components/**/*.html']))
.pipe(gettext.extract('template.pot', { attributes: ['placeholder'] }))
.pipe(gulp.dest('po/'))
.on('end', done);
});
ekaragodin commented
This fixed in gettext-tools v2.2.2 https://github.com/rubenv/angular-gettext-tools/blob/v2.2.2/lib/extract.js#L175