Skip to content

Commit

Permalink
Grunt ready for transifex - add checktextdomain - exec + new tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
fxbenard committed Jun 2, 2015
1 parent d57505a commit b5e2b6d
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
50 changes: 50 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,50 @@ module.exports = function(grunt) {
}]
}
},

checktextdomain: {
options: {
text_domain: 'cmb2',
create_report_file: true,
keywords: [
'__:1,2d',
'_e:1,2d',
'_x:1,2c,3d',
'esc_html__:1,2d',
'esc_html_e:1,2d',
'esc_html_x:1,2c,3d',
'esc_attr__:1,2d',
'esc_attr_e:1,2d',
'esc_attr_x:1,2c,3d',
'_ex:1,2c,3d',
'_n:1,2,4d',
'_nx:1,2,4c,5d',
'_n_noop:1,2,3d',
'_nx_noop:1,2,3c,4d',
' __ngettext:1,2,3d',
'__ngettext_noop:1,2,3d',
'_c:1,2d',
'_nc:1,2,4c,5d'
]
},
files: {
src: [
'**/*.php', // Include all files
'!node_modules/**', // Exclude node_modules/
],
expand: true
}
},

exec: {
txpull: { // Pull Transifex translation - grunt exec:txpull
cmd: 'tx pull -a -f' // Change the percentage with --minimum-perc=yourvalue
},
txpush_s: { // Push pot to Transifex - grunt exec:txpush_s
cmd: 'tx push -s'
},
},

// concat: {
// options: {
// stripBanners: true,
Expand Down Expand Up @@ -234,4 +278,10 @@ module.exports = function(grunt) {
grunt.registerTask('js', ['asciify', 'jshint', 'uglify']);
grunt.registerTask('tests', ['asciify', 'jshint', 'phpunit']);
grunt.registerTask('default', ['styles', 'js', 'tests']);
//Checktextdomain and makepot task(s)
grunt.registerTask('build:i18n', ['checktextdomain', 'makepot', 'newer:potomo']);
//Makepot and push it on Transifex task(s).
grunt.registerTask('tx-push', ['makepot', 'exec:txpush_s']);
//Pull from Transifex and create .mo task(s).
grunt.registerTask('tx-pull', ['exec:txpull', 'newer:potomo']);
};
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"devDependencies": {
"grunt": "~0.4.4",
"grunt-asciify": "~0.2.2",
"grunt-checktextdomain": "^1.0.0",
"grunt-combine-media-queries": "~1.0.15",
"grunt-contrib-compress": "^0.11.0",
"grunt-contrib-cssmin": "^0.9.0",
Expand All @@ -30,7 +31,9 @@
"grunt-contrib-uglify": "^0.4.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-csscomb": "~3.0.0-1",
"grunt-exec": "^0.4.6",
"grunt-githooks": "~0.3.1",
"grunt-newer": "^1.1.0",
"grunt-phpunit": "~0.3.3",
"grunt-potomo": "^3.1.1",
"grunt-update-submodules": "~0.4.1",
Expand Down

0 comments on commit b5e2b6d

Please sign in to comment.