@@ -984,3 +984,137 @@ Feature: Split PO files into JSON files.
984984 """
985985 And the return code should be 0
986986 And the foo-theme/my-custom-domain-de_DE-557240f2080a0894dbd39f5c2f559bf8.json file should exist
987+
988+ Scenario : Should only process js/min.js extensions by default
989+ Given an empty foo-theme directory
990+ And a foo-theme/de_DE.po file:
991+ """
992+ # Copyright (C) 2018 Foo Theme
993+ # This file is distributed under the same license as the Foo Plugin package.
994+ msgid ""
995+ msgstr ""
996+ "Project-Id-Version: Foo Plugin\n"
997+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n"
998+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
999+ "Language-Team: LANGUAGE <LL@li.org>\n"
1000+ "Language: de_DE\n"
1001+ "MIME-Version: 1.0\n"
1002+ "Content-Type: text/plain; charset=UTF-8\n"
1003+ "Content-Transfer-Encoding: 8bit\n"
1004+ "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n"
1005+ "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
1006+ "X-Domain: foo-theme\n"
1007+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
1008+
1009+ #: foo-theme.js:15
1010+ msgid "Foo Theme"
1011+ msgstr "Foo Theme"
1012+
1013+ #: bar.min.minified.min.js:15
1014+ msgid "Foo Theme"
1015+ msgstr "Foo Theme"
1016+
1017+ #: foo-theme.ts:15
1018+ msgid "Foo Theme"
1019+ msgstr "Foo Theme"
1020+
1021+ #: foo-theme.tag:15
1022+ msgid "Foo Theme"
1023+ msgstr "Foo Theme"
1024+ """
1025+
1026+ When I run `wp i18n make-json foo-theme`
1027+ Then STDOUT should contain:
1028+ """
1029+ Success: Created 2 files.
1030+ """
1031+ And the return code should be 0
1032+ And the foo-theme/foo-theme-de_DE-557240f2080a0894dbd39f5c2f559bf8.json file should exist
1033+ And the foo-theme/foo-theme-de_DE-a9c6627f5fe96185c0a0d0ddd8fa0216.json file should exist
1034+
1035+ Scenario : Allows processing custom file extensions
1036+ Given an empty foo-theme directory
1037+ And a foo-theme/de_DE.po file:
1038+ """
1039+ # Copyright (C) 2018 Foo Theme
1040+ # This file is distributed under the same license as the Foo Plugin package.
1041+ msgid ""
1042+ msgstr ""
1043+ "Project-Id-Version: Foo Plugin\n"
1044+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n"
1045+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1046+ "Language-Team: LANGUAGE <LL@li.org>\n"
1047+ "Language: de_DE\n"
1048+ "MIME-Version: 1.0\n"
1049+ "Content-Type: text/plain; charset=UTF-8\n"
1050+ "Content-Transfer-Encoding: 8bit\n"
1051+ "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n"
1052+ "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
1053+ "X-Domain: foo-theme\n"
1054+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
1055+
1056+ #: foo-theme.js:15
1057+ msgid "Foo Theme"
1058+ msgstr "Foo Theme"
1059+
1060+ #: foo-theme.ts:15
1061+ msgid "Foo Theme"
1062+ msgstr "Foo Theme"
1063+
1064+ #: foo-theme.tag:15
1065+ msgid "Foo Theme"
1066+ msgstr "Foo Theme"
1067+ """
1068+
1069+ When I run `wp i18n make-json foo-theme --extensions=ts,tag`
1070+ Then STDOUT should contain:
1071+ """
1072+ Success: Created 3 files.
1073+ """
1074+ And the return code should be 0
1075+ And the foo-theme/foo-theme-de_DE-557240f2080a0894dbd39f5c2f559bf8.json file should exist
1076+ And the foo-theme/foo-theme-de_DE-a4e9f6529ffa4750907c140158b834b9.json file should exist
1077+ And the foo-theme/foo-theme-de_DE-df975addfaa8d6579df3d3133999691a.json file should exist
1078+
1079+ Scenario : Should use extensions, strip spaces and . from notation
1080+ Given an empty foo-theme directory
1081+ And a foo-theme/de_DE.po file:
1082+ """
1083+ # Copyright (C) 2018 Foo Theme
1084+ # This file is distributed under the same license as the Foo Plugin package.
1085+ msgid ""
1086+ msgstr ""
1087+ "Project-Id-Version: Foo Plugin\n"
1088+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n"
1089+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1090+ "Language-Team: LANGUAGE <LL@li.org>\n"
1091+ "Language: de_DE\n"
1092+ "MIME-Version: 1.0\n"
1093+ "Content-Type: text/plain; charset=UTF-8\n"
1094+ "Content-Transfer-Encoding: 8bit\n"
1095+ "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n"
1096+ "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
1097+ "X-Domain: foo-theme\n"
1098+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
1099+
1100+ #: foo-theme.js:15
1101+ msgid "Foo Theme"
1102+ msgstr "Foo Theme"
1103+
1104+ #: foo-theme.ts:15
1105+ msgid "Foo Theme"
1106+ msgstr "Foo Theme"
1107+
1108+ #: foo-theme.tag:15
1109+ msgid "Foo Theme"
1110+ msgstr "Foo Theme"
1111+ """
1112+
1113+ When I run `wp i18n make-json foo-theme --extensions=".ts, .tsx" `
1114+ Then STDOUT should contain:
1115+ """
1116+ Success: Created 2 files.
1117+ """
1118+ And the return code should be 0
1119+ And the foo-theme/foo-theme-de_DE-557240f2080a0894dbd39f5c2f559bf8.json file should exist
1120+ And the foo-theme/foo-theme-de_DE-a4e9f6529ffa4750907c140158b834b9.json file should exist
0 commit comments