Index: /trunk/src/wp-includes/class.wp-scripts.php
===================================================================
--- /trunk/src/wp-includes/class.wp-scripts.php (revision 53359)
+++ /trunk/src/wp-includes/class.wp-scripts.php (revision 53360)
@@ -311,4 +311,6 @@
$inline_script_tag = '';
}
+
+ $translations_stop_concat = ! empty( $obj->textdomain );
$translations = $this->print_translations( $handle, false );
@@ -328,5 +330,5 @@
$srce = apply_filters( 'script_loader_src', $src, $handle );
- if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations ) ) {
+ if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations_stop_concat ) ) {
$this->do_concat = false;
Index: /trunk/tests/phpunit/tests/dependencies/scripts.php
===================================================================
--- /trunk/tests/phpunit/tests/dependencies/scripts.php (revision 53359)
+++ /trunk/tests/phpunit/tests/dependencies/scripts.php (revision 53360)
@@ -1482,3 +1482,37 @@
);
}
+
+ /**
+ * @ticket 55628
+ * @covers ::wp_set_script_translations
+ */
+ public function test_wp_external_wp_i18n_print_order() {
+ global $wp_scripts;
+
+ $wp_scripts->do_concat = true;
+ $wp_scripts->default_dirs = array( '/default/' );
+
+ // wp-i18n script in a non-default directory.
+ wp_register_script( 'wp-i18n', '/plugins/wp-i18n.js', array(), null );
+ // Script in default dir that's going to be concatenated.
+ wp_enqueue_script( 'jquery-core', '/default/jquery-core.js', array(), null );
+ // Script in default dir that depends on wp-i18n.
+ wp_enqueue_script( 'common', '/default/common.js', array(), null );
+ wp_set_script_translations( 'common' );
+
+ $print_scripts = get_echo(
+ function() {
+ wp_print_scripts();
+ _print_scripts();
+ }
+ );
+
+ // The non-default script should end concatenation and maintain order.
+ $ver = get_bloginfo( 'version' );
+ $expected = "\n";
+ $expected .= "\n";
+ $expected .= "\n";
+
+ $this->assertSame( $expected, $print_scripts );
+ }
}