This repository was archived by the owner on Jan 15, 2024. It is now read-only.
forked from Freemius/wordpress-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
42 lines (39 loc) · 1.32 KB
/
gulpfile.js
File metadata and controls
42 lines (39 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var gulp = require('gulp');
var wpPot = require('gulp-wp-pot');
var gettext = require('gulp-gettext');
var sort = require('gulp-sort');
var pofill = require('gulp-pofill');
var rename = require('gulp-rename');
gulp.task('default', function () {
// Create POT out of i18n.php.
gulp.src('includes/i18n.php')
.pipe(sort())
.pipe(wpPot( {
destFile:'freemius.pot',
package: 'freemius',
bugReport: 'https://github.com/Freemius/wordpress-sdk/issues',
lastTranslator: 'Vova Feldman <vova@freemius.com>',
team: 'Freemius Team <admin@freemius.com>'
} ))
.pipe(gulp.dest('languages/'));
// Create English PO out of the POT.
gulp.src('languages/freemius.pot')
.pipe(pofill({
items: function(item) {
// If msgstr is empty, use identity translation
if (!item.msgstr.length) {
item.msgstr = [''];
}
if (!item.msgstr[0]) {
item.msgstr[0] = item.msgid;
}
return item;
}
}))
.pipe(rename('freemius-en.po'))
.pipe(gulp.dest('languages/'));
// Compile POs to MOs.
gulp.src('languages/*.po')
.pipe(gettext())
.pipe(gulp.dest('languages/'))
});