Skip to content

Commit

Permalink
Merge pull request #57 from wp-cli/53-generator
Browse files Browse the repository at this point in the history
Add X-Generator header to POT file
  • Loading branch information
schlessera authored Jul 31, 2018
2 parents e1aa166 + b4dcde8 commit ecf6de7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions features/makepot.feature
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Feature: Generate a POT file of a WordPress plugin
When I run `wp scaffold plugin hello-world`

When I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
And the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
"""
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hello-world\n"
"""
Expand Down Expand Up @@ -125,12 +125,18 @@ Feature: Generate a POT file of a WordPress plugin
When I run `wp scaffold plugin hello-world`

When I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
And the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
"""
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"""

Scenario: Sets the generator header
When I run `wp scaffold plugin hello-world`

When I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
Then the contents of the wp-content/plugins/hello-world/languages/hello-world.pot file should match /X-Generator:\s/

Scenario: Ignores any other text domain
Given an empty foo-plugin directory
And a foo-plugin/foo-plugin.php file:
Expand Down
1 change: 1 addition & 0 deletions src/MakePotCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ protected function set_default_headers() {
$this->translations->setHeader( 'Report-Msgid-Bugs-To', $meta['msgid-bugs-address'] );
$this->translations->setHeader( 'Last-Translator', 'FULL NAME <EMAIL@ADDRESS>' );
$this->translations->setHeader( 'Language-Team', 'LANGUAGE <[email protected]>' );
$this->translations->setHeader( 'X-Generator', 'WP-CLI ' . WP_CLI_VERSION );

foreach( $this->headers as $key => $value ) {
$this->translations->setHeader( $key, $value );
Expand Down

0 comments on commit ecf6de7

Please sign in to comment.