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

WordPress Trac noreply at wordpress.org
Thu Nov 21 12:48:50 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):

 The recommendation from `_doing_it_wrong` suggests using `init` as the
 right hook for loading translations.
 The warning should recommend the use of `init` **with a low priority**.
 (preferably 0 or a negative number)
 If developers use `init` without specifying a priority (meaning priority
 10), there could be issues.

 For example, post types and taxonomies are usually registered on `init`.
 This requires language files to be loaded because labels are translatable.

 Another option would be to recommend `after_setup_theme`, but this could
 also be problematic because the user is not yet authenticated. (and the
 Site Language option from the user's profile is ignored)

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


More information about the wp-trac mailing list