diff --git a/features/makephp.feature b/features/makephp.feature index eda279c..0095922 100644 --- a/features/makephp.feature +++ b/features/makephp.feature @@ -153,7 +153,39 @@ Feature: Generate PHP files from PO files And STDERR should be empty And the foo-plugin/foo-plugin-de_DE.l10n.php file should contain: """ - return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=n != 1;','language'=>'de_DE','project-id-version'=>'Development (5.2.x)','pot-creation-date'=>'','po-revision-date'=>'2019-03-28 19:42+0300','x-generator'=>'Poedit 2.2.1','messages'=>['html_lang_attribute'=>'de-DE','text directionltr'=>'ltr','number_format_decimal_point'=>',','number_format_thousands_sep'=>'.','Update %s now'=>'Jetzt %s aktualisieren','[%1$s] Confirm Action: %2$s'=>'[%1$s] Aktion bestätigen: %2$s','[%s] Erasure Request Fulfilled'=>'[%s] Löschauftrag ausgeführt','[%s] Personal Data Export'=>'[%s] Export personenbezogener Daten']]; + return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=n != 1;','language'=>'de_DE','project-id-version'=>'Development (5.2.x)','pot-creation-date'=>'','translation-revision-date'=>'2019-03-28 19:42+0300','x-generator'=>'Poedit 2.2.1','messages'=>['html_lang_attribute'=>'de-DE','text directionltr'=>'ltr','number_format_decimal_point'=>',','number_format_thousands_sep'=>'.','Update %s now'=>'Jetzt %s aktualisieren','[%1$s] Confirm Action: %2$s'=>'[%1$s] Aktion bestätigen: %2$s','[%s] Erasure Request Fulfilled'=>'[%s] Löschauftrag ausgeführt','[%s] Personal Data Export'=>'[%s] Export personenbezogener Daten']]; + """ + + Scenario: Writes the revision date as translation-revision-date + 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" + "Language: de_DE\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" + "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n" + "Plural-Forms: nplurals=2; plural=(n != 1);\n" + + #: foo-plugin.php:15 + msgid "Foo Plugin" + msgstr "Bar Plugin" + """ + + When I run `wp i18n make-php foo-plugin` + Then the return code should be 0 + And the foo-plugin/foo-plugin-de_DE.l10n.php file should contain: + """ + 'translation-revision-date'=>'2018-05-02T22:06:24+00:00' + """ + And the foo-plugin/foo-plugin-de_DE.l10n.php file should not contain: + """ + 'po-revision-date' """ Scenario: Does include translations diff --git a/src/PhpArrayGenerator.php b/src/PhpArrayGenerator.php index 2c8a320..a4c931d 100644 --- a/src/PhpArrayGenerator.php +++ b/src/PhpArrayGenerator.php @@ -72,9 +72,10 @@ protected static function toArray( Translations $translations, $include_headers, $result['language'] = $language; } + // GlotPress exports the revision date as `translation-revision-date`, so use that name here too. $headers_allowlist = [ 'POT-Creation-Date' => 'pot-creation-date', - 'PO-Revision-Date' => 'po-revision-date', + 'PO-Revision-Date' => 'translation-revision-date', 'Project-Id-Version' => 'project-id-version', 'X-Generator' => 'x-generator', ];