[wp-trac] [WordPress Trac] #26511: Introduce a locale-switching function
WordPress Trac
noreply at wordpress.org
Tue Oct 25 16:08:51 UTC 2016
#26511: Introduce a locale-switching function
-------------------------------------------------+-------------------------
Reporter: johnbillion | Owner: swissspidy
Type: feature request | Status: accepted
Priority: high | Milestone: 4.7
Component: I18N | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs-dev- | Focuses:
note |
-------------------------------------------------+-------------------------
Comment (by ocean90):
[attachment:26511.16.diff]: Changes the check to use `get_user_locale()`
in admin.
{{{
$current_locale = is_admin() ? get_user_locale() : get_locale();
if ( $current_locale === $locale ) {
return false;
}
}}}
There is a new test `test_switch_to_site_locale_if_user_locale_is_set()`.
It's currently failing because `restore_current_locale()` doesn't restore
`$l10n`. Hmm, that makes actually sense since the value was empty before
because of `en_US`. Need to test this with another locale…
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26511#comment:96>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list