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
34 changes: 33 additions & 1 deletion features/makephp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/PhpArrayGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ 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 = [
'Project-Id-Version' => 'project-id-version',
'POT-Creation-Date' => 'pot-creation-date',
'PO-Revision-Date' => 'po-revision-date',
'PO-Revision-Date' => 'translation-revision-date',
'X-Generator' => 'x-generator',
];
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

Expand Down