[wp-trac] [WordPress Trac] #44937: Add _doing_it_wrong to load_plugin_textdomain

WordPress Trac noreply at wordpress.org
Mon Sep 30 15:28:44 UTC 2024


#44937: Add _doing_it_wrong to load_plugin_textdomain
-----------------------------+-------------------------
 Reporter:  garrett-eclipse  |       Owner:  swissspidy
     Type:  enhancement      |      Status:  closed
 Priority:  normal           |   Milestone:  6.7
Component:  I18N             |     Version:  4.7
 Severity:  normal           |  Resolution:  fixed
 Keywords:  has-patch        |     Focuses:
-----------------------------+-------------------------
Changes (by swissspidy):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"59127" 59127]:
 {{{
 #!CommitTicketReference repository="" revision="59127"
 I18N: Emit warnings if loading translations too early.

 Some plugins and themes load translations too early, before the current
 user is known.
 This happens either explicitly or through just-in-time translation
 loading.

 If the current user (and thus their locale) is not known, WordPress might
 attempt to load translations in the wrong locale.

 This change adds `_doing_it_wrong` messages to warn about such cases. It
 also helps avoiding accidentally trying to load translations twice (once
 just-in-time and once manually).

 Projects triggering such a message are encourage to load translations no
 earlier than the `after_setup_theme` hook.

 Props garrett-eclipse, Kau-Boy, swissspidy, johnbillion, alanfuller.
 rodelgc.
 Fixes #44937.
 }}}

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


More information about the wp-trac mailing list