google / google/site-kit-wp

Perform a check for non-standard site languages to reduce "Incorrect locale information provided" errors

Open
#7,589 0 comments 0 reactions 0 assignees View on GitHub
Type: Enhancement Type: Support
Dominant language
JavaScript
Stars
1.4k
Forks
383
Avg merge
4d 12h
Merged PRs (30d)
80

Description

## Bug Description

If a user has an invalid site language defined, which would be through a third party plugin or as a WP constant, the Site Kit dashboard may not be accessible, with errors appearing on the screen, and more via console errors.

To resolve this, perform a check for any invalid language before set up or upon visiting the dashboard. Output an error or some context if possible.

The below is on a custom hosted site with an invalid language set via wp-config

![image](https://github.com/google/site-kit-wp/assets/41326532/5af310d2-a811-4bf1-9779-1e64a782eec4)

The below screenshot is on a TasteWP site with an invalid language set via :
```
add_action('locale', function(){
return '12345_INVALID';
});
```

![image](https://github.com/google/site-kit-wp/assets/41326532/e3cd2541-7f90-4d1b-b877-6bd3bbc4abf0)

## Steps to reproduce

1. Set up Site Kit
2. Define an invalid language via wp-config or functions.php (see above example in screenshot)
3. Check the Site Health status to ensure the invalid language is applied
4. Visit the Site Kit dashboard, where the error appears

## Additional Context

- Site Kit 1.109.9
- This is rare, but it did come up twice in the forums
- [Internal testing](https://app.asana.com/0/1185360131189553/1205462773641873/f)

## Impacted users
- https://wordpress.org/support/topic/problem-with-sitekit-dashboard/ | **Open** - awaiting feedback
- https://wordpress.org/support/topic/incorrect-locale-information-provided-need-suport/ | **Resolved** - no response | [Site Language](https://i.imgur.com/OVecFFT.png)

---------------

_Do not alter or remove anything below. The following sections will be managed by moderators only._

## Acceptance criteria

*

## Implementation Brief

*

### Test Coverage

*

## QA Brief

*

## Changelog entry

*

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by setting an invalid locale through wp-config or functions.php, then confirm it in Site Health and visit the Site Kit dashboard. Trace the setup or dashboard path that surfaces the locale error; done means invalid languages are detected before setup or dashboard use and users receive useful context instead of the current failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, wordpress
Domain
frontend, localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.