Skip to content

WP-Translations/grunt-transifex-wordpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License [Tool] (http://wp-translations.org)

Grunt Transifex WordPress

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

Requirements

Getting started

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

Setup & Configuration

Transifex

TX configuration

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

TX client config file

In .tx->config replace the project_slug and the pot_slug by your own Transifex project data.

Creates pot

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.
		}
	}
}

Checktexdomain

In your Gruntfile.js, replace in the section named checktextdomain the text_domain option:

checktextdomain: {
			options:{
				text_domain: 'foo',  //Name of Your textdomain

Creates pot and pushes it to Transifex

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!

How it works

Creates pot

grunt makepot

Check textdomain and makepot

grunt go-pot

Creates pot and pushes it to Transifex

grunt tx-push

Pulls translations from Transifex and creates the .mo files

grunt tx-pull

Extras: Builds a zip folder of all your files - ready to use

grunt build

Thanks to:

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 ;)

About

A Grunt workflow for integrating Transifex in your WordPress projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •