Make WordPress Core

Opened 4 weeks ago

Last modified 7 days ago

#61518 new enhancement

Switch locale to admin locale when sending admin notifications

Reported by: benniledl's profile benniledl Owned by:
Milestone: 6.7 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch needs-refresh needs-unit-tests
Focuses: administration Cc:

Description

This patch takes the locale of the user associated with the admin_email and falls back to the site language if there is no user associated with this email address.

Change History (6)

This ticket was mentioned in PR #6919 on WordPress/wordpress-develop by @benniledl.


4 weeks ago
#1

  • Keywords has-patch added

This patch adds a new funciton called get_admin_locale it takes the locale of the user associated with the admin_email and falls back to the site language if there is no user associated with this email address.

Also the patch switches to the get_admin_locale function in the admin email notifications instead of get_locale

Trac ticket: https://core.trac.wordpress.org/ticket/61518

#3 @benniledl
3 weeks ago

Do you think we can milestone this to 6.7? @swissspidy

This ticket was mentioned in Slack in #core-i18n by benniledl. View the logs.


7 days ago

#5 @swissspidy
7 days ago

  • Keywords needs-refresh needs-unit-tests added
  • Milestone changed from Awaiting Review to 6.7

@swissspidy commented on PR #6919:


7 days ago
#6

@at-benni I just pushed some changes to your branch to also update wp_notify_postauthor() and wp_notify_moderator to do the same thing. They're a bit more complex as they loop through a bunch of emails, but they would also benefit from switching to the correct locale per recipient.

We might want to do a single restore_current_locale() instead of doing restore_previous_locale() in a loop, for performance reasons.

In addition to manual testing, this change would benefit from some unit tests. At least wp_new_user_notification has some test coverage already, so we can start there.

Note: See TracTickets for help on using tickets.