Skip to content

Commit

Permalink
Update for transifex + grunt workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fxbenard committed Feb 6, 2015
1 parent a59111b commit 4e28dab
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[main]
host = https://www.transifex.com

[aesop-story-engine.aesop-core]
file_filter = languages/aesop-core-<lang>.po
source_file = languages/aesop-core.pot
source_lang = en_US
type = PO
61 changes: 60 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,69 @@ module.exports = function(grunt) {
]
}

}
},

makepot: {
target: {
options: {
domainPath: '/languages/', // Where to save the POT file.
exclude: ['build/.*'],
mainFile: 'aesop-core.php', // Main project file.
potFilename: 'aesop-core.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-plugin', // 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://aesopinteractive.com/';
pot.headers['last-translator'] = 'WP-Translations (http://wp-translations.org/)\n';
pot.headers['language-team'] = 'WP-Translations <[email protected]>\n';
pot.headers['language'] = 'en_US';
return pot;
}
}
}
},

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

dirs: {
lang: 'languages', // It should be languages or lang
},

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
}]
}
},
});

// register task
grunt.registerTask('default', ['watch']);

// 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' ] );

};
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
"load-grunt-tasks": "~0.2.1"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt": "~0.4.5",
"grunt-contrib-less": "~0.9.0",
"grunt-contrib-jshint": "~0.8.0",
"grunt-contrib-uglify": "~0.2.7",
"grunt-contrib-watch": "~0.5.3",
"grunt-phplint": "~0.0.5",
"grunt-cssjanus": "~0.2.2"
"grunt-cssjanus": "~0.2.2",
"grunt-exec": "~0.4.5",
"grunt-wp-i18n": "~0.4.9",
"grunt-potomo": "~2.1.0"
}
}

0 comments on commit 4e28dab

Please sign in to comment.