Make WordPress Core

Opened 18 months ago

Closed 18 months ago

Last modified 15 months ago

#46694 closed enhancement (fixed)

Site Health: Debug copy field uses site locale, not user locale

Reported by: Clorith Owned by: desrosj
Milestone: 5.2 Priority: normal
Severity: normal Version:
Component: Site Health Keywords: site-health has-patch commit
Focuses: Cc:


The Debug Information part of the site health element takes the sites locale into account, and allows a user to copy either an English, or a translated version of the information for use when seeking support.

This currently checks the site language, as it was implemented before core supported different locales per user.

This should be updated, as a user looking for localized help is likely to choose their own language over the site language if they should differ.

Attachments (2)

46694.patch (1.4 KB) - added by Clorith 18 months ago.
46694.diff (1.7 KB) - added by desrosj 18 months ago.

Download all attachments as: .zip

Change History (10)

#1 @SergeyBiryukov
18 months ago

  • Component changed from General to Administration

#2 @azaozz
18 months ago

Related: #46726.

18 months ago

#3 @Clorith
18 months ago

  • Keywords has-patch added; needs-patch removed

46694.patch replaces our use of get_locale to instead use get_user_locale, to reflect that this is the user viewing things, so they may have different preferential language options from the site it self.

#4 @Clorith
18 months ago

  • Keywords commit added

#5 @desrosj
18 months ago

  • Owner set to desrosj
  • Status changed from new to reviewing

18 months ago

#6 @desrosj
18 months ago

While reviewing this, I noticed that there are function_exists() checks for switch_to_locale() and restore_locale(). I confirmed with @Clorith that these were in the plugin version of Site Health for the purpose of supporting older versions of WordPress. These are no longer needed, as all WordPress 5.2 installs will have these functions.

#7 @desrosj
18 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 45110:

Site Health: Ensure the user locale is listed in debug information.

This change switches to using get_user_locale() when adding the language to the Site Health debug information to ensure the user’s locale preference is reflected.

Also, function_exists() checks for switch_to_locale() and restore_previous_locale() were required in the plugin to support older versions of WordPress, but they are not required in core/

Props: Clorith, desrosj.
Fixes #46694.

#8 @spacedmonkey
15 months ago

  • Component changed from Administration to Site Health
Note: See TracTickets for help on using tickets.