[wp-trac] [WordPress Trac] #64229: Enqueueing scripts, styles, and script modules should warn when dependencies are missing

WordPress Trac noreply at wordpress.org
Tue Jan 27 06:41:47 UTC 2026


#64229: Enqueueing scripts, styles, and script modules should warn when
dependencies are missing
-------------------------------------+-------------------------------------
 Reporter:  westonruter              |       Owner:  westonruter
     Type:  enhancement              |      Status:  reopened
 Priority:  normal                   |   Milestone:  6.9.1
Component:  Script Loader            |     Version:  6.9
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch has-unit-      |     Focuses:  javascript,
  tests fixed-major dev-reviewed     |  performance
-------------------------------------+-------------------------------------

Comment (by wildworks):

 This is a minor point, but please don't hard-code the comma. The type of
 separator and whether or not there's a space after the separator may
 differ depending on the locale.

 I think we'll need to use the `wp_get_list_item_separator()` function.

 Recommended code example:

 {{{
 #!php
 protected function get_dependency_warning_message( $handle,
 $missing_dependency_handles ) {
         $comma = wp_get_list_item_separator();
         return sprintf(
                 /* translators: 1: Script handle, 2: List of missing
 dependency handles. */
                 __( 'The script with the handle "%1$s" was enqueued with
 dependencies that are not registered: %2$s.' ),
                 $handle,
                 implode( $comma, $missing_dependency_handles )
         );
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64229#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list