Skip to content

Commit

Permalink
Update package for wp-i18n - makepot - exec
Browse files Browse the repository at this point in the history
  • Loading branch information
fxbenard committed Oct 13, 2014
1 parent 7379ccd commit 323fbef
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
53 changes: 51 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,51 @@ module.exports = function(grunt) {
target: {
options: {
domainPath: '/languages/', // Where to save the POT file.
potFilename: 'portfolio-press.pot', // Name of the POT file.
type: 'wp-theme' // Type of project (wp-plugin or wp-theme).
potFilename: 'portfolio-press.pot', // Name of the POT file
potHeaders: {
poedit: true, // Includes common Poedit headers.
'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
},
type: 'wp-theme', // Type of project (wp-plugin or wp-theme).
updateTimestamp: true, // Whether the POT-Creation-Date should be updated without other changes.
processPot: function( pot, options ) {
pot.headers['report-msgid-bugs-to'] = 'http://wptheming.com/';
pot.headers['last-translator'] = 'WP-Translations (http://wp-translations.org/)';
pot.headers['language-team'] = 'WP-Translations <[email protected]>';
pot.headers['language'] = 'en_US';
return pot;
}
}
}
},
exec: {
txpull: { // Pull Transifex translation - grunt exec:txpull
cmd: 'tx pull -a --minimum-perc=100' // Change the percentage with --minimum-perc=yourvalue
},
txpush_s: { // Push pot to Transifex - grunt exec:txpush_s
cmd: 'tx push -s'
},
},

dirs: {
lang: 'languages',
},

potomo: {
dist: {
options: {
poDel: false // Set to true if you want to erase the .po
},
files: [{
expand: true,
cwd: '<%= dirs.lang %>',
src: ['*.po'],
dest: '<%= dirs.lang %>',
ext: '.mo',
nonull: true
}]
}
},
cssjanus: {
theme: {
options: {
Expand All @@ -74,4 +114,13 @@ module.exports = function(grunt) {
'cssjanus'
]);

// Default task. - grunt makepot
grunt.registerTask( 'default', 'makepot' );

// Makepot and push it on Transifex task(s).
grunt.registerTask( 'makandpush', [ 'makepot', 'exec:txpush_s' ] );

// Pull from Transifex and create .mo task(s).
grunt.registerTask( 'tx', [ 'exec:txpull', 'potomo' ] );

};
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"grunt-csscomb" : "~3.0.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-uglify": "~0.4.0",
"grunt-wp-i18n": "~0.4.3",
"grunt-cssjanus" : "^0.2.2"
"grunt-wp-i18n": "~0.4.8",
"grunt-potomo": "~2.1.0",
"grunt-cssjanus" : "^0.2.2",
"grunt-exec": "~0.4.5"
}
}

0 comments on commit 323fbef

Please sign in to comment.