[wp-trac] [WordPress Trac] #38535: Don't init WP_Locale_Switcher in wp_load_translations_early()
WordPress Trac
noreply at wordpress.org
Thu Oct 27 20:21:15 UTC 2016
#38535: Don't init WP_Locale_Switcher in wp_load_translations_early()
--------------------------+-----------------------
Reporter: ocean90 | Owner:
Type: defect (bug) | Status: new
Priority: high | Milestone: 4.7
Component: I18N | Version: trunk
Severity: normal | Keywords: has-patch
Focuses: |
--------------------------+-----------------------
See [comment:ticket:29783:59].
`WP_Locale_Switcher` uses `get_locale()`/`get_user_locale()` to set the
original locale. Both functions can return a fatal error if WordPress
isn't fully initialized. [38976] tries to fix this but in a bad way.
`wp_load_translations_early()` sets the locale based on various factors
like `WPLANG` or `$wp_local_package`. [38976] assumes that it's always
`en_US`.
I'm not aware of a use case where someone would need to switch locales
while the site is crashing. I'm proposing to revert [38976] and [38977]
and to remove `WP_Locale_Switcher` from `wp_load_translations_early()`.
Related: #30049
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38535>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list