@@ -2608,6 +2608,7 @@ Feature: Generate a POT file of a WordPress project
26082608 """
26092609 #. translators: %s: test
26102610 #: foo-plugin.js:1
2611+ #, js-format
26112612 msgid "Hi %s"
26122613 msgstr ""
26132614 """
@@ -4097,3 +4098,60 @@ Feature: Generate a POT file of a WordPress project
40974098 """
40984099 msgid "Not extracted style variation description"
40994100 """
4101+
4102+ Scenario : Add php-format and js-format flags for printf usage
4103+ Given an empty foo-plugin directory
4104+ And a foo-plugin/foo-plugin.php file:
4105+ """
4106+ <?php
4107+ /**
4108+ * Plugin Name: Foo Plugin
4109+ * Plugin URI: https://example.com
4110+ * Description:
4111+ * Version: 0.1.0
4112+ * Author:
4113+ * Author URI:
4114+ * License: GPL-2.0+
4115+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
4116+ * Text Domain: foo-plugin
4117+ * Domain Path: /languages
4118+ */
4119+
4120+ /* translators: %s: Name */
4121+ __( 'Hello %s', 'foo-plugin' );
4122+ /* translators: 1: Name */
4123+ __( 'Bonjour %1$s', 'foo-plugin' );
4124+ """
4125+ And a foo-plugin/foo.js file:
4126+ """
4127+ /* translators: %s: Name */
4128+ __( 'Hallo %s', 'foo-plugin' );
4129+ /* translators: 1: Name */
4130+ __( 'Buongiorno %1$s', 'foo-plugin' );
4131+ """
4132+
4133+ When I run `wp i18n make-pot foo-plugin foo-plugin.pot`
4134+ Then the foo-plugin.pot file should contain:
4135+ """
4136+ #: foo-plugin.php:16
4137+ #, php-format
4138+ msgid "Hello %s"
4139+ """
4140+ And the foo-plugin.pot file should contain:
4141+ """
4142+ #: foo-plugin.php:18
4143+ #, php-format
4144+ msgid "Bonjour %1$s"
4145+ """
4146+ And the foo-plugin.pot file should contain:
4147+ """
4148+ #: foo.js:2
4149+ #, js-format
4150+ msgid "Hallo %s"
4151+ """
4152+ And the foo-plugin.pot file should contain:
4153+ """
4154+ #: foo.js:4
4155+ #, js-format
4156+ msgid "Buongiorno %1$s"
4157+ """
0 commit comments