[wp-trac] [WordPress Trac] #39210: switch_to_locale() unloads all plugin and theme translations

WordPress Trac noreply at wordpress.org
Thu Oct 20 21:55:26 UTC 2022


#39210: switch_to_locale() unloads all plugin and theme translations
-------------------------------------------------+-------------------------
 Reporter:  gchtr                                |       Owner:  ocean90
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.1
Component:  I18N                                 |     Version:  4.7
 Severity:  normal                               |  Resolution:
 Keywords:  has-unit-tests has-patch needs-dev-  |     Focuses:
  note                                           |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:72 flixos90]:
 > Simply adding a `$wp_textdomain_registry->set( $domain, $locale, false
 );` above the above line fixes the problem for me, by storing that there
 is no translation file in that situation, the same way it is already done
 when the translation file cannot be imported.
 >
 > Potentially this may introduce another problem that I'm unfamiliar with,
 but at least the above change is where I would have started.

 I'm not super familiar with this code either, but it looks like this was
 previously tried in #51678. While that would restore the performance, it
 seems to break what this ticket aimed to achieve.

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


More information about the wp-trac mailing list