Add gulp task for .pot file generation

This commit is contained in:
Dmitriy Simushev 2014-08-13 08:40:42 +00:00
parent 547cd5abb6
commit f583aa6439
2 changed files with 36 additions and 2 deletions

View File

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

View File

@ -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"
}