Skip to content

Commit

Permalink
Merge pull request #165 from claudiosmweb/feature-languages
Browse files Browse the repository at this point in the history
Download languages files from Transifex and create .mo files
  • Loading branch information
jameskoster committed Apr 16, 2015
2 parents efad07f + c136af3 commit b7ca832
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .tx/config
@@ -0,0 +1,8 @@
[main]
host = https://www.transifex.com

[storefront-1.storefront]
file_filter = languages/<lang>.po
source_file = languages/storefront.pot
source_lang = en
type = PO
52 changes: 50 additions & 2 deletions Gruntfile.js
Expand Up @@ -128,6 +128,9 @@ module.exports = function( grunt ) {
frontend: {
options: {
potFilename: 'storefront.pot',
exclude: [
'storefront/.*' // Exclude deploy directory
],
processPot: function ( pot ) {
pot.headers['project-id-version'];
return pot;
Expand Down Expand Up @@ -184,8 +187,40 @@ module.exports = function( grunt ) {
expand: true,
dot: true
}
}
},

// Shell actions for transifex client
shell: {
options: {
stdout: true,
stderr: true
},
txpush: {
command: 'tx push -s' // push the resources
},
txpull: {
command: 'tx pull -a -f' // pull the .po files
}
},

// Convert .po to .mo
potomo: {
options: {
poDel: false
},
dist: {
files: [{
expand: true,
cwd: 'languages/',
src: [
'*.po'
],
dest: 'languages/',
ext: '.mo',
nonull: true
}]
}
}
});

// Load NPM tasks to be used here
Expand All @@ -197,6 +232,8 @@ module.exports = function( grunt ) {
grunt.loadNpmTasks( 'grunt-wp-i18n' );
grunt.loadNpmTasks( 'grunt-checktextdomain' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-shell' );
grunt.loadNpmTasks( 'grunt-potomo' );

// Register tasks
grunt.registerTask( 'default', [
Expand All @@ -209,12 +246,23 @@ module.exports = function( grunt ) {
'cssmin'
]);

grunt.registerTask( 'tx_update', [
'makepot',
'shell:txpush'
]);

grunt.registerTask( 'dev', [
'default',
'makepot'
'tx_update'
]);

grunt.registerTask( 'mo', [
'shell:txpull',
'potomo'
]);

grunt.registerTask( 'deploy', [
'mo',
'copy'
]);
};
4 changes: 2 additions & 2 deletions languages/storefront.pot
Expand Up @@ -2,9 +2,9 @@
# This file is distributed under the GNU General Public License v2 or later.
msgid ""
msgstr ""
"Project-Id-Version: Storefront 1.4.3\n"
"Project-Id-Version: Storefront 1.4.4\n"
"Report-Msgid-Bugs-To: https://github.com/woothemes/storefront/issues\n"
"POT-Creation-Date: 2015-04-08 10:55:40+00:00\n"
"POT-Creation-Date: 2015-04-15 20:54:33+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -20,7 +20,9 @@
"node-sass": "^2.1.1",
"susy": "^2.2.2",
"node-bourbon": "~4.2.1-beta1",
"grunt-contrib-copy": "~0.5.0"
"grunt-contrib-copy": "~0.5.0",
"grunt-potomo": "~3.2.1",
"grunt-shell": "~1.1.2"
},
"engines": {
"node": ">=0.8.0",
Expand Down

0 comments on commit b7ca832

Please sign in to comment.