[wp-trac] [WordPress Trac] #37997: Increase in function calls to get_locale() because of _load_textdomain_just_in_time()
WordPress Trac
noreply at wordpress.org
Sat Nov 19 10:14:10 UTC 2016
#37997: Increase in function calls to get_locale() because of
_load_textdomain_just_in_time()
-------------------------------------------------+-------------------------
Reporter: sharkomatic | Owner: ocean90
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 4.7
Component: I18N | Version: 4.6
Severity: normal | Resolution:
Keywords: needs-testing has-patch has-unit- | Focuses:
tests | performance
-------------------------------------------------+-------------------------
Changes (by swissspidy):
* keywords: needs-testing has-patch needs-unit-tests => needs-testing has-
patch has-unit-tests
Comment:
[attachment:37997.4.diff] fixes the test added in the previous patch. In
addition to the filter in the original test overriding any locale
switching, `WP_Locale_Switcher::load_translations()` indeed loaded the
previous MO file again after unloading the text domain.
I didn't check why this has been working so far, but in this new patch I
greatly simplified the translation loading in `WP_Locale_Switcher` by just
calling `unload_textdomain( $domain )` and then
`get_translations_for_domain( $domain )`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37997#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list