-
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.
make-php: skip strings without translation
- Loading branch information
1 parent
46e9483
commit e2ca4a6
Showing
2 changed files
with
56 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -204,3 +204,58 @@ Feature: Generate PHP files from PO files | |
""" | ||
return ['domain'=>'foo-plugin','plural-forms'=>'nplurals=2; plural=(n != 1);','language'=>'de_DE','project-id-version'=>'Foo Plugin','pot-creation-date'=>'2018-05-02T22:06:24+00:00','po-revision-date'=>'2018-05-02T22:06:24+00:00','messages'=>['Plugin NameFoo Plugin (EN)'=>'Foo Plugin (DE)','Foo Plugin'=>'Bar Plugin','You have %d new message'=>'Sie haben %d neue Nachricht' . "\0" . 'Sie haben %d neue Nachrichten']]; | ||
""" | ||
|
||
Scenario: Excludes strings without translations | ||
Given an empty foo-plugin directory | ||
And a foo-plugin/foo-plugin-de_DE.po file: | ||
""" | ||
# Copyright (C) 2018 Foo Plugin | ||
# This file is distributed under the same license as the Foo Plugin package. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Foo Plugin\n" | ||
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
"Language: de_DE\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"POT-Creation-Date: 2018-05-02T22:06:24+00:00\n" | ||
"PO-Revision-Date: 2018-05-02T22:06:24+00:00\n" | ||
"X-Domain: foo-plugin\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
#: foo-plugin.php:10 | ||
msgid "I exist" | ||
msgstr "I exist (DE)" | ||
#: foo-plugin.php:20 | ||
msgid "I am empty" | ||
msgstr "" | ||
#: foo-plugin.php:30 | ||
msgid "You have %d new message" | ||
msgid_plural "You have %d new messages" | ||
msgstr[0] "" | ||
msgstr[1] "" | ||
""" | ||
|
||
When I run `wp i18n make-php foo-plugin` | ||
Then STDOUT should contain: | ||
""" | ||
Success: Created 1 file. | ||
""" | ||
And the return code should be 0 | ||
And the foo-plugin/foo-plugin-de_DE.l10n.php file should contain: | ||
""" | ||
I exist | ||
""" | ||
And the foo-plugin/foo-plugin-de_DE.l10n.php file should not contain: | ||
""" | ||
I am empty | ||
""" | ||
And the foo-plugin/foo-plugin-de_DE.l10n.php file should not contain: | ||
""" | ||
new message | ||
""" |
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