translations.js 841 B

12345678910111213141516171819202122232425262728
  1. var gulp = require('gulp');
  2. var plugins = require('gulp-load-plugins')();
  3. var renameLangs = require('../plugins/gulp-rename-langs.js');
  4. var splitTranslations = require('../plugins/gulp-split-translations.js');
  5. var sanitizeTranslations = require('../plugins/gulp-sanitize-translations.js');
  6. module.exports = function(config) {
  7. gulp.task('translations:extract', function() {
  8. return gulp
  9. .src(['build/dev/**/*.{js,html}'])
  10. .pipe(plugins.angularGettext.extract('main.pot'))
  11. .pipe(gulp.dest('build/translations'));
  12. });
  13. gulp.task('translations:compile', function() {
  14. return gulp
  15. .src(config.libDir + '/' + config.translations + '/**/*.po')
  16. .pipe(
  17. plugins.angularGettext.compile({
  18. format: 'json',
  19. })
  20. )
  21. .pipe(renameLangs())
  22. .pipe(sanitizeTranslations())
  23. .pipe(gulp.dest('src/translations'));
  24. });
  25. };