rubenv/angular-gettext

Strings are not extracted from es6 modules

ekaragodin opened this issue · 2 comments

import angular from 'angular';

angular.controller('GreetingController', function(gettextCatalog) {
    this.message = gettextCatalog.getString("Hello");
});

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