0

I'm using gulp and gettext, all works well except when I have multiple .po files.

gulp.task('translations', function () {
    return gulp.src('app/po/*.po')
        .pipe($.gettext.compile())
        .pipe($.rename('translations.js'))
        .pipe(gulp.dest(dest));
    });

I have three .po files: lang1.po, lang2.po and lang3.po, and I only get lang3.po in translations.js. I guess this task is overwriting things. Any suggestions how I can cat everything together into translations.js ?

Jeanluca Scaljeri
  • 26,343
  • 56
  • 205
  • 333

1 Answers1

1

What you are doing here is:

  • step 1: compile lang1.po, compile lang2.po, compile lang3.po
  • step 2: rename lang1.po to translations.js, rename lang2.po to translations.js, rename lang3.po to translations.js

Get the idea?

You probably want to concat instead (using gulp-concat).

gulp.task('translations', function () {
  return gulp.src('app/po/*.po')
    .pipe($.gettext.compile())
    .pipe(concat('translations.js')))
    .pipe(gulp.dest(dest));
});

Hope that helps.

Mangled Deutz
  • 11,384
  • 6
  • 39
  • 35