1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00

Push source and pull all the translations from Transifex when running gulp translate.

This commit is contained in:
Gunther Brunner 2015-07-10 21:14:02 +09:00
parent 8203f32e01
commit 5f77474786
2 changed files with 19 additions and 2 deletions

View file

@ -17,6 +17,7 @@ var karma = require('karma').server
var karmaConfig = '/res/test/karma.conf.js' var karmaConfig = '/res/test/karma.conf.js'
var stream = require('stream') var stream = require('stream')
var jscs = require('gulp-jscs') var jscs = require('gulp-jscs')
var run = require('gulp-run')
gulp.task('jshint', function () { gulp.task('jshint', function () {
return gulp.src([ return gulp.src([
@ -166,7 +167,7 @@ gulp.task("webpack:others", function (callback) {
}) })
}) })
gulp.task('translate', ['jade', 'translate:extract', 'translate:compile']) gulp.task('translate', ['translate:compile'])
gulp.task('jade', function (cb) { gulp.task('jade', function (cb) {
return gulp.src([ return gulp.src([
@ -193,7 +194,7 @@ gulp.task('translate:extract', ['jade'], function (cb) {
.pipe(gulp.dest('./res/common/lang/po/')) .pipe(gulp.dest('./res/common/lang/po/'))
}) })
gulp.task('translate:compile', ['translate:extract'], function (cb) { gulp.task('translate:compile', ['translate:pull'], function (cb) {
return gulp.src('./res/common/lang/po/**/*.po') return gulp.src('./res/common/lang/po/**/*.po')
.pipe(gettext.compile({ .pipe(gettext.compile({
format: 'json' format: 'json'
@ -201,6 +202,21 @@ gulp.task('translate:compile', ['translate:extract'], function (cb) {
.pipe(gulp.dest('./res/common/lang/translations/')) .pipe(gulp.dest('./res/common/lang/translations/'))
}) })
gulp.task('translate:push', ['translate:extract'], function () {
gutil.log('Pushing translation source to Transifex...')
return run('tx push -s').exec()
})
gulp.task('translate:pull', ['translate:push'], function () {
gutil.log('Pulling translations from Transifex...')
return run('tx pull').exec()
})
gulp.task('clean', function (cb) { gulp.task('clean', function (cb) {
del(['./tmp', './res/build'], cb) del(['./tmp', './res/build'], cb)
}) })

View file

@ -93,6 +93,7 @@
"gulp-jshint": "^1.9.4", "gulp-jshint": "^1.9.4",
"gulp-jsonlint": "^1.0.2", "gulp-jsonlint": "^1.0.2",
"gulp-protractor": "^0.0.12", "gulp-protractor": "^0.0.12",
"gulp-run": "^1.6.8",
"gulp-util": "^3.0.4", "gulp-util": "^3.0.4",
"html-loader": "^0.3.0", "html-loader": "^0.3.0",
"imports-loader": "^0.6.3", "imports-loader": "^0.6.3",