[wp-trac] [WordPress Trac] #63944: load_script_textdomain doesn't use plugin's DomainPath for translation lookup

WordPress Trac noreply at wordpress.org
Mon Sep 8 08:41:33 UTC 2025


#63944: load_script_textdomain doesn't use plugin's DomainPath for translation
lookup
------------------------------------------+---------------------
 Reporter:  jsnajdr                       |       Owner:  (none)
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  6.9
Component:  I18N                          |     Version:  5.0
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+---------------------

Comment (by tusharbharti):

 Hi, while exploring this, I think I found the main issue for this.
 In function `load_script_textdomain`

 {{{#!php
 <?php
         if ( $path ) {
         $translations = load_script_translations( $path . '/' .
 $md5_filename, $handle, $domain );

                 if ( $translations ) {
                         return $translations;
                 }
         }


         $translations = load_script_translations( $languages_path . '/' .
 $md5_filename, $handle, $domain );

         if ( $translations ) {
                 return $translations;
         }
 }}}



 adding

 {{{#!php
 <?php
         global $wp_textdomain_registry;
         if ( isset( $wp_textdomain_registry ) ) {
                 $reg_path = $wp_textdomain_registry->get( $domain, $locale
 );
                 if ( $reg_path ) {
                         $reg_path = untrailingslashit( $reg_path );

                         $translations = load_script_translations(
 $reg_path . '/' . $md5_filename, $handle, $domain );
                         if ( $translations ) {
                                 return $translations;
                         }
                 }
         }
 }}}


 should fix it.
 If this is fine, I would love to write the patch and unit tests

 cc: @swissspidy

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


More information about the wp-trac mailing list