Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added example about meta data handling #38

Merged
merged 1 commit into from
Oct 9, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/makepot.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,48 @@ grunt.initConfig({
}
});
```
### Meta data of Plugins/Themes

You may use the `processPot` callback to control which meta data is automatically added to the POT file. This may be useful if you don't want Author or Plugin/Theme names and urls to be translatable.

```js
grunt.initConfig({
makepot: {
target: {
options: {
processPot: function( pot ) {
var translation, excluded_meta = [
'Plugin Name of the plugin/theme',
'Plugin URI of the plugin/theme',
'Author of the plugin/theme',
'Author URI of the plugin/theme'
];
for ( translation in pot.translations[''] ) {
if ( typeof pot.translations[''][translation].comments.extracted != 'undefined' ) {
if ( excluded_meta.indexOf( pot.translations[''][translation].comments.extracted ) >= 0 ) {
delete pot.translations[''][translation];
console.log( 'Excluded meta: ' + pot.translations[''][translation].comments.extracted );
}
}
}
return pot;
},
type: 'wp-plugin'
}
}
}
});
```

The following strings are recognized:

```
Plugin Name of the plugin/theme
Theme Name of the plugin/theme
Plugin URI of the plugin/theme
Theme URI of the plugin/theme
Description of the plugin/theme
Author of the plugin/theme
Author URI of the plugin/theme
Tags of the plugin/theme
```