[wp-trac] [WordPress Trac] #39210: switch_to_locale() unloads all plugin and theme translations
WordPress Trac
noreply at wordpress.org
Tue Oct 20 16:26:13 UTC 2020
#39210: switch_to_locale() unloads all plugin and theme translations
-------------------------------------------------+-------------------------
Reporter: gchtr | Owner: ocean90
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 5.6
Component: I18N | Version: 4.7
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests needs-dev- | Focuses:
note |
-------------------------------------------------+-------------------------
Comment (by ocean90):
Replying to [comment:29 dd32]:
> Replying to [comment:28 ocean90]:
> > dd32 Instead of adding the new flag to `unload_textdomain()` the
latest patch doesn't call `unload_textdomain()` anymore, instead it
[https://github.com/WordPress/wordpress-
develop/pull/613#discussion_r507067828 "uses unset( $l10n[ $domain ] );"].
Curious what you think about this.
>
> It seems fine to me, it's cleaner than the extra parameter IMHO,
although it should probably be documented in the code as to why it unsets
the global rather than calling the API (unload_textdomain) as it may not
seem obvious at first to a casual reader.
I went back and forth on this and decided to go with the extra parameter
for `unload_textdomain()`, just to be on the safe side because
`unload_textdomain()` has a filter and action which would no longer be
called.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39210#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list