Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion features/makejson.feature
Original file line number Diff line number Diff line change
Expand Up @@ -984,4 +984,3 @@ Feature: Split PO files into JSON files.
"""
And the return code should be 0
And the foo-theme/my-custom-domain-de_DE-557240f2080a0894dbd39f5c2f559bf8.json file should exist

54 changes: 22 additions & 32 deletions features/makepot.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Feature: Generate a POT file of a WordPress project

When I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should exist
Then STDOUT should be:
And STDOUT should be:
"""
Plugin file detected.
Success: POT file successfully generated.
Expand All @@ -58,8 +58,7 @@ Feature: Generate a POT file of a WordPress project

Scenario: Does not include empty file headers.
When I run `wp scaffold plugin hello-world --plugin_description=""`

When I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
And I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should exist
And the wp-content/plugins/hello-world/languages/hello-world.pot file should not contain:
"""
Expand Down Expand Up @@ -102,13 +101,12 @@ Feature: Generate a POT file of a WordPress project

Scenario: Adds copyright comments
When I run `wp scaffold plugin hello-world`

When I run `date +"%Y"`
And I run `date +"%Y"`
Then STDOUT should not be empty
And save STDOUT as {YEAR}

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:
"""
# Copyright (C) {YEAR} YOUR NAME HERE
# This file is distributed under the same license as the Hello World plugin.
Expand Down Expand Up @@ -144,27 +142,24 @@ Feature: Generate a POT file of a WordPress project

Scenario: Sets Project-Id-Version
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:
And I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
"""
"Project-Id-Version: Hello World 0.1.0\n"
"""

Scenario: Sets Report-Msgid-Bugs-To
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 I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
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"
"""

Scenario: Sets custom Report-Msgid-Bugs-To
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 --headers='{"Report-Msgid-Bugs-To":"https://github.com/hello-world/hello-world/"}'`
And the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
And I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot --headers='{"Report-Msgid-Bugs-To":"https://github.com/hello-world/hello-world/"}'`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
"""
"Report-Msgid-Bugs-To: https://github.com/hello-world/hello-world/\n"
"""
Expand All @@ -175,26 +170,23 @@ Feature: Generate a POT file of a WordPress project

Scenario: Sets custom 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 --headers='{"X-Poedit-Basepath":".."}'`
And the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
And I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot --headers='{"X-Poedit-Basepath":".."}'`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
"""
"X-Poedit-Basepath: ..\n"
"""

Scenario: Sets a placeholder PO-Revision-Date 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`
And I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
"""
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"""

Scenario: Sets the last translator and the language team
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 I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
"""
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
Expand All @@ -203,8 +195,7 @@ Feature: Generate a POT file of a WordPress project

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`
And 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
Expand Down Expand Up @@ -589,7 +580,7 @@ Feature: Generate a POT file of a WordPress project
Scenario: Extract translator comments
Given I run `echo "\t"`
And save STDOUT as {TAB}
Given an empty foo-plugin directory
And an empty foo-plugin directory
And a foo-plugin/foo-plugin.php file:
"""
<?php
Expand Down Expand Up @@ -1018,7 +1009,7 @@ Feature: Generate a POT file of a WordPress project
"""
Extracted 4 strings
"""
Then the foo-plugin.pot file should not contain:
And the foo-plugin.pot file should not contain:
"""
I am being ignored
"""
Expand Down Expand Up @@ -1057,7 +1048,7 @@ Feature: Generate a POT file of a WordPress project
<?php
__( 'I am being ignored', 'foo-plugin' );
"""
And a foo-plugin/bar/ignored.js file:
And a foo-plugin/bar/ignored.js file:
"""
__( 'I am being ignored', 'foo-plugin' );
"""
Expand Down Expand Up @@ -1554,7 +1545,7 @@ Feature: Generate a POT file of a WordPress project

When I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot --merge=foo-plugin/foo-plugin.pot`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should exist
Then STDOUT should be:
And STDOUT should be:
"""
Plugin file detected.
Success: POT file successfully generated.
Expand Down Expand Up @@ -1625,7 +1616,7 @@ Feature: Generate a POT file of a WordPress project

When I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot --merge=foo-plugin/foo-plugin.pot,foo-plugin/bar-plugin.pot`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should exist
Then STDOUT should be:
And STDOUT should be:
"""
Plugin file detected.
Success: POT file successfully generated.
Expand Down Expand Up @@ -1734,7 +1725,7 @@ Feature: Generate a POT file of a WordPress project

When I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot --merge=foo-plugin/foo-plugin.pot`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should exist
Then STDOUT should be:
And STDOUT should be:
"""
Plugin file detected.
Success: POT file successfully generated.
Expand Down Expand Up @@ -2324,7 +2315,7 @@ Feature: Generate a POT file of a WordPress project
"""
msgid "bar"
"""
And the foo-plugin.pot file should not contain:
And the foo-plugin.pot file should not contain:
"""
msgid "Hello JSX"
"""
Expand Down Expand Up @@ -2462,7 +2453,7 @@ Feature: Generate a POT file of a WordPress project
"""
msgid "Hello World from PHP"
"""
And the foo-plugin.pot file should contain:
And the foo-plugin.pot file should contain:
"""
msgid "Hello World from JavaScript"
"""
Expand Down Expand Up @@ -3680,7 +3671,6 @@ Feature: Generate a POT file of a WordPress project
msgid "Black"
"""


Scenario: Extract strings from the top-level section of theme.json files
Given an empty foo-theme directory
And a foo-theme/theme.json file:
Expand Down