-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update for transifex + grunt workflow
- Loading branch information
Showing
3 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' ] ); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters