[wp-trac] [WordPress Trac] #62462: Revert _doing_it_wrong warning when loading translations early

WordPress Trac noreply at wordpress.org
Thu Nov 21 13:58:36 UTC 2024


#62462: Revert _doing_it_wrong warning when loading translations early
-------------------------------+---------------------
 Reporter:  TimothyBlynJacobs  |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  6.7.2
Component:  I18N               |     Version:  6.7
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+---------------------

Comment (by EusebiuOprinoiu):

 Yes. The problem is that many developers will follow your suggestion
 blindly and use `init` as a drop-in replacement for `plugins_loaded` to
 eliminate the warnings generated by `_doing_it_wrong`.

 Because `init` is usually the earliest action where translatable strings
 are needed, and because `init` is often used without an explicit priority,
 my suggestion is to change the warning message with a recommendation that
 will cause fewer issues if followed blindly.

 **Current message:**
 Translation loading for the theme/plugin domain was triggered too early.
 This is usually an indicator for some code in the plugin or theme running
 too early. Translations should be loaded at the **init** action or later.

 **Possible improved message:**
 Translation loading for the theme/plugin domain was triggered too early.
 This is usually an indicator for some code in the plugin or theme running
 too early. Translations should be loaded at the **after_setup_theme**
 action or later. In most cases, **init** with **priority 0** can be used
 without issues.

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


More information about the wp-trac mailing list