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

WordPress Trac noreply at wordpress.org
Fri Apr 13 16:17:44 UTC 2018


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

Comment (by pcfreak30):

 So I spent a good few hours debugging this to find this bug! The bottom
 line is you can unload translations, but you cant add them back unless
 they are the core ones. the
 {{{_load_textdomain_just_in_time}}} function needs {{{|| isset(
 $l10n_unloaded[ $domain ] )}}}
 removed. I was doing this as part of a multisite plugin activation routine
 with rewrite rules since the language switcher would NOT switch languages
 properly.

 Here is a gist of some of the code in my (public) plugin that I had to use
 to get my use case fully working:
 https://gist.github.com/pcfreak30/12a0023518863ad75c2c05c76e8f53da

 I think there is a design flaw in this that needs to be looked at again.

 Thanks!

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


More information about the wp-trac mailing list