Script Loader: Use localized list separators in dependency warning messages#10799
Script Loader: Use localized list separators in dependency warning messages#10799t-hamano wants to merge 2 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
How to test this PRSwitch the site locale to Japanese and enqueue a script with a non-existent dependency in an active theme. Example: diff --git a/src/wp-content/themes/twentytwentyfive/functions.php b/src/wp-content/themes/twentytwentyfive/functions.php
index 8e4acf1e35..b30bdd93a5 100644
--- a/src/wp-content/themes/twentytwentyfive/functions.php
+++ b/src/wp-content/themes/twentytwentyfive/functions.php
@@ -157,3 +157,14 @@ if ( ! function_exists( 'twentytwentyfive_format_binding' ) ) :
}
}
endif;
+
+add_action( 'wp_enqueue_scripts', function () {
+ wp_register_script(
+ 'test-missing-deps',
+ includes_url( 'js/wp-embed.min.js' ),
+ array( 'non-existent-dependency-1', 'non-existent-dependency-2', 'non-existent-dependency-3' ),
+ null,
+ true
+ );
+ wp_enqueue_script( 'test-missing-deps' );
+} );Then, open http://localhost:8889/ Make sure the separator is
|
|
Did some quick review and found same error for #10799 (comment) diff code. |
There was a problem hiding this comment.
Pull request overview
This PR updates dependency warning messages across WordPress script and style loaders to use localized list separators instead of hardcoded comma-space separators. This allows different locales to format dependency lists according to their language conventions.
Changes:
- Replaced hardcoded
', 'separators withwp_get_list_item_separator()function calls in dependency warning messages - Updated translator comments to reflect that the separators are now locale-aware
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/wp-includes/class-wp-dependencies.php | Updated base class dependency warning message to use localized list separator |
| src/wp-includes/class-wp-scripts.php | Updated script-specific dependency warning message to use localized list separator |
| src/wp-includes/class-wp-styles.php | Updated style-specific dependency warning message to use localized list separator |
| src/wp-includes/class-wp-script-modules.php | Updated script module dependency warning message to use localized list separator |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This PR has been committed in https://core.trac.wordpress.org/changeset/61542 |

Trac ticket: https://core.trac.wordpress.org/ticket/64229
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.