@@ -488,6 +488,10 @@ Feature: Update existing PO files from a POT file
488488 #: foo-plugin.php:1
489489 msgid "Some string"
490490 msgstr ""
491+
492+ #: foo-plugin.php:2
493+ msgid "Some other string"
494+ msgstr ""
491495 """
492496 And a foo-plugin/foo-plugin-de_DE.po file:
493497 """
@@ -528,6 +532,58 @@ Feature: Update existing PO files from a POT file
528532 "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
529533 """
530534
535+ Scenario : Keeps POT file order of translations
536+ Given an empty foo-plugin directory
537+ And a foo-plugin/foo-plugin.pot file:
538+ """
539+ # Copyright (C) 2018 Foo Plugin
540+ # This file is distributed under the same license as the Foo Plugin package.
541+ msgid ""
542+ msgstr ""
543+ "Project-Id-Version: Foo Plugin\n"
544+ "Content-Type: text/plain; charset=UTF-8\n"
545+ "X-Domain: foo-plugin\n"
546+
547+ #: foo-plugin.php:1
548+ msgid "First string"
549+ msgstr ""
550+
551+ #: foo-plugin.php:10
552+ msgid "Second string"
553+ msgstr ""
554+
555+ #: foo-plugin.php:20
556+ msgid "Third string"
557+ msgstr ""
558+ """
559+ And a foo-plugin/foo-plugin-de_DE.po file:
560+ """
561+ # Copyright (C) 2018 Foo Plugin
562+ # This file is distributed under the same license as the Foo Plugin package.
563+ msgid ""
564+ msgstr ""
565+ "Project-Id-Version: Foo Plugin\n"
566+ "Content-Type: text/plain; charset=UTF-8\n"
567+ "Language: de_DE\n"
568+ "X-Domain: foo-plugin\n"
569+
570+ #: foo-plugin.php:20
571+ msgid "Third string"
572+ msgstr "Dritte Zeichenfolge"
573+
574+ #: foo-plugin.php:1
575+ msgid "First string"
576+ msgstr "Erste Zeichenfolge"
577+ """
578+
579+ When I run `wp i18n update-po foo-plugin/foo-plugin.pot foo-plugin/foo-plugin-de_DE.po`
580+ Then STDOUT should be:
581+ """
582+ Success: Updated 1 file.
583+ """
584+ And STDERR should be empty
585+ And the contents of the foo-plugin/foo-plugin-de_DE.po file should match /First string.*Second string.*Third string/s
586+
531587 Scenario : Reports unchanged files when POT hasn't changed
532588 Given an empty foo-plugin directory
533589 And a foo-plugin/foo-plugin.pot file:
0 commit comments