-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from wp-cli/53-generator
Add X-Generator header to POT file
- Loading branch information
Showing
2 changed files
with
9 additions
and
2 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 |
---|---|---|
|
@@ -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" | ||
""" | ||
|
@@ -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: | ||
|
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 |
---|---|---|
|
@@ -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 ); | ||
|