[wp-trac] [WordPress Trac] #26511: Introduce a locale-switching function

WordPress Trac noreply at wordpress.org
Tue Oct 18 15:13:29 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 swissspidy):

 > * `wp_new_user_notification()`: The email for `admin_email` should be
 sent using the site locale (`get_locale()`).

 Makes sense. I somehow didn't think of that scenario (`is_admin()` being
 true and thus the locale "wrong") while working on the latest patch. Fixed
 in [attachment:26511.9.diff].

 > * `wp_update_user()`: When `$user['locale']` isn't set `get_locale()`
 should be used for the `switch_to_locale()` call.
 > * `ms-delete-site.php`: Why is this using `get_user_locale()`? I think
 it should be `get_locale()`.
 > * `wpmu_signup_user_notification()`: Unlike
 `wpmu_signup_blog_notification()`, `wpmu_signup_user_notification()` is
 also used in the admin on wp-admin/user-new.php for multisite. If the user
 already exists it should use their locale, otherwise `get_locale()`.

 Fixed in the latest patch.

 > * `wpmu_signup_blog_notification()`: The function is only used on `wp-
 signup.php`, the front end. `switch_to_locale()` would only be needed if
 it's used in the admin. Maybe there are plugins which are using the
 function in the admin?

 Better to be safe than sorry.

 > * `wp_notify_moderator()`: Well, that's a mess. But we should at least
 make sure that it's always using the site locale.

 Did that now, but also added that in `wp_notify_postauthor()`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/26511#comment:79>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list