Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#46694 closed enhancement (fixed)

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

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

Description

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 6 years ago.
46694.diff (1.7 KB) - added by desrosj 6 years ago.

Download all attachments as: .zip

Change History (10)

#1 @SergeyBiryukov
6 years ago

  • Component changed from General to Administration

#2 @azaozz
6 years ago

Related: #46726.

@Clorith
6 years ago

#3 @Clorith
6 years 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
6 years ago

  • Keywords commit added

#5 @desrosj
6 years ago

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

@desrosj
6 years ago

#6 @desrosj
6 years 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
6 years 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
5 years ago

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