[] (http://wp-translations.org)
A set of grunt tasks to integrate i18n tools and Transifex to your WordPress plugin/theme Grunt workflow.
-
Creates pot
-
Creates pot and pushes it to Transifex
-
Pulls translations from Transifex and creates the .mo files
-
Extras: Builds a zip folder of all your files - ready to use
- Node.js - Install Node.js
- Grunt-cli and Grunt (
npm install grunt-cli -g
) - Transifex Client - Install tx client
- Gettext - Install Gettext or
brew install gettext
-> Homebrew formula for OS X - PHP CLI in your system path.
If you haven't used Grunt before, check out Chris Coyier's post on getting started with Grunt.
And for more WP-Grunt tools check out Devin Price's post Using Grunt with WordPress Themes.
Clone this repo, cd to the directory, run npm install
to install the necessary packages.
git clone https://github.com/WP-Translations/grunt-transifex-wordpress
cd grunt-transifex-wordpress
npm install
grunt
Make sure you have a ~/.transifexrc. It is unique per user and stores the hostname, username and password for every Transifex server that you are using. It is stored in the user's home directory.
[https://www.transifex.com]
username = user
token =
password = p@ssw0rd
hostname = https://www.transifex.com
More info about setting up your Transifex client
In .tx->config replace the project_slug and the pot_slug by your own Transifex project data.
In your Gruntfile.js, replace in the section named makepot
the data below:
makepot: {
target: {
options: {
mainFile: 'foo.php', // Main project file.
potFilename: 'foo.pot', // Name of the POT file.
type: 'wp-plugin', // Type of project (wp-plugin or wp-theme).
updateTimestamp: true, // Whether the POT-Creation-Date should be updated without other changes.
updatePoFiles: false // Whether to update PO files in the same directory as the POT file.
}
}
}
In your Gruntfile.js, replace in the section named checktextdomain
the text_domain option:
checktextdomain: {
options:{
text_domain: 'foo', //Name of Your textdomain
In your Gruntfile.js, replace in the section named exec
the -- minimum percentage value if needed:
exec: {
txpull: { // Pull Transifex translation - grunt exec:txpull
cmd: 'tx pull -a --minimum-perc=100' // Change the percentage with --minimum-perc=yourvalue
}
}
That's it you're ready to Grunt it
now with those commands!
grunt makepot
grunt go-pot
grunt tx-push
grunt tx-pull
grunt build
grunt-wp-i18n by Brady Vercher to generate the .pot files.
grunt-potomo by AxisThemes to generate automatically the .mo files.
transifex client the client command tool and much more ...
All the Grunt Crew & @grappler, the i18n Petit-Suisse expert ;)