[wp-trac] [WordPress Trac] #39342: locale switcher: switching to `get_locale` is useless
WordPress Trac
noreply at wordpress.org
Tue Dec 20 11:58:34 UTC 2016
#39342: locale switcher: switching to `get_locale` is useless
--------------------------+-----------------------------
Reporter: yoavf | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version: 4.7
Severity: minor | Keywords:
Focuses: |
--------------------------+-----------------------------
With the introduction of the locale switcher in [38961], we've implemented
3 core switches that use `get_locale()` as the locale argument:
`switch_to_locale( get_locale() );`
[https://core.trac.wordpress.org/browser/tags/4.7/src/wp-admin/ms-delete-
site.php#L45 delete site email]
[https://core.trac.wordpress.org/browser/tags/4.7/src/wp-
includes/pluggable.php#L1581 wp_notify_postauthor]
[https://core.trac.wordpress.org/browser/tags/4.7/src/wp-
includes/pluggable.php#L1757 wp_new_user_notification]
Switching to `get_locale()` is useless because `locale` gets filtered by
the locale switcher, which will use the last locale switched to as the
return value. So we're just switching to the current locale (if no locale
switch has ever happened) or to the current locale again if we did switch.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39342>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list