Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#39342 closed defect (bug) (invalid)

locale switcher: switching to `get_locale` is useless

Reported by: yoavf's profile yoavf Owned by:
Milestone: Priority: normal
Severity: minor Version: 4.7
Component: I18N Keywords:
Focuses: Cc:

Description

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() );

delete site email
wp_notify_postauthor
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.


Attachments (1)

test_39342.diff (3.3 KB) - added by yoavf 8 years ago.
Test demonstrating the issue

Download all attachments as: .zip

Change History (3)

@yoavf
8 years ago

Test demonstrating the issue

#1 follow-up: @ocean90
8 years ago

Why should it be useless if a user locale is X but the site locale is Y? How would you make sure that the emails are sent in the language of the site?

#2 in reply to: ↑ 1 @yoavf
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Bah, you're right! I was missing something while testing here, the test actually passes with current code. Sorry!

Note: See TracTickets for help on using tickets.