diff --git a/src/gulpfile.js b/src/gulpfile.js index cc989820..348e82c4 100644 --- a/src/gulpfile.js +++ b/src/gulpfile.js @@ -14,7 +14,9 @@ var fs = require('fs'), zip = require('gulp-zip'), tar = require('gulp-tar'), gzip = require('gulp-gzip'), - chmod = require('gulp-chmod'); + chmod = require('gulp-chmod'), + xgettext = require('gulp-xgettext'), + concatPo = require('gulp-concat-po'); // Set global configs. var config = { @@ -143,6 +145,32 @@ gulp.task('page-styles', function() { .pipe(gulp.dest(stylePath + '/templates_compiled/client_side')); }); +// Generate .pot files based on the sources +gulp.task('generate-pot', function() { + return gulp.src([ + config.mibewPath + '/**/*.php', + '!' + config.phpVendorPath + '/**/*.*', + '!' + config.pluginsPath + '/**/*.*' + ]) + .pipe(xgettext({ + language: 'PHP', + keywords: [ + {name: 'getlocal'} + ] + })) + .pipe(concatPo('translation.pot', { + headers: { + 'Project-Id-Version': config.package.version, + 'Report-Msgid-Bugs-To': config.package.bugs.email, + 'PO-Revision-Date': '', + 'Last-Translator': '', + 'Language-Team': '', + 'Content-Type': 'text/plain; charset=UTF-8' + } + })) + .pipe(gulp.dest('release')); +}); + // Pack sources to .zip and .tar.gz archives. gulp.task('pack-sources', ['composer-install'], function() { var sources = config.mibewPath + '/**/*', @@ -162,7 +190,7 @@ gulp.task('pack-sources', ['composer-install'], function() { // Builds all the sources gulp.task('default', function(callback) { runSequence( - ['phpcs', 'js', 'chat-styles', 'page-styles'], + ['phpcs', 'js', 'chat-styles', 'page-styles', 'generate-pot'], 'pack-sources', callback ); diff --git a/src/package.json b/src/package.json index 6bf08434..70c7c565 100644 --- a/src/package.json +++ b/src/package.json @@ -3,6 +3,10 @@ "version": "2.0.0-alpha2", "description": "Mibew Messenger - open-source live support application", "private": true, + "bugs": { + "email": "support@mibew.org", + "url": "https://github.com/mibew/mibew/issues" + }, "devDependencies": { "gulp": "~3.8.0", "gulp-phpcs": "~0.1.0", @@ -16,6 +20,8 @@ "gulp-tar": "~1.0.0", "gulp-gzip": "~0.0.8", "gulp-chmod": "~1.1.0", + "gulp-xgettext": "~0.2.0", + "gulp-concat-po": "~0.1.0", "run-sequence": "~0.3.6", "event-stream": "~3.1.7" }