[wp-trac] [WordPress Trac] #53677: load_script_textdomain() doesn't work for subdirectory themes, or those in alternate theme roots

WordPress Trac noreply at wordpress.org
Fri Jul 16 07:08:25 UTC 2021


#53677: load_script_textdomain() doesn't work for subdirectory themes, or those in
alternate theme roots
--------------------------+-----------------------------
 Reporter:  dd32          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:
 Severity:  normal        |   Keywords:
  Focuses:  javascript    |
--------------------------+-----------------------------
 load_script_textdomain() attempts to load script translations for themes,
 but fails to generate the correct relative filename when the theme is
 within a sub-directory or alternate theme root.

 WordPress supports three main formats for theme directories (See
 [https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/theme.php#L427 search_theme_directories()])
  1. wp-content/themes/$theme
  2. wp-content/custom-theme-root/$theme
  3. wp-content/themes/a-directory-of-themes/$theme (and likewise for the
 custom $theme_root)

 The first case is covered, but when using the other two, the generated
 relative path and subsequent path md5 is incorrect.

 For example, given the file `.../themes/a-directory-of-
 themes/$theme/build/index.min.js` instead of generating the md5 of
 `build/index.js` it generates it of `$theme/build/index.js`.

 I'm unsure what it would do with the custom theme roots, all that I can
 tell is that the use-case doesn't appear to be covered in the function.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53677>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list