[wp-trac] [WordPress Trac] #50749: wp_set_script_translations() ignores failure when called before script is registered.

WordPress Trac noreply at wordpress.org
Fri Jul 24 11:03:48 UTC 2020


#50749: wp_set_script_translations() ignores failure when called before script is
registered.
--------------------------+------------------------------
 Reporter:  tellyworth    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  I18N          |     Version:  5.4
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------

Comment (by swissspidy):

 > This would be easily fixed by having `wp_set_script_translations()`
 trigger `_doing_it_wrong` when `$wp_scripts->set_translations()` returns
 `false`.

 Note that `$wp_scripts->set_translations()` will also return `false` if
 the domain is not a string. That would be an easy checck to add to
 `wp_set_script_translations` as well.

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


More information about the wp-trac mailing list