Automattic / Automattic/jetpack
I18n: get_locale calls involve much boilerplate code
Open
[Focus] i18n
[Focus] Jetstream
Enhancement
General
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
When calling `get_locale` Jetpack code often checks for existence of the `GL_Locales` class and requires the file if it's not defined. This code is used in several places and can be abstracted to make everything more DRY:
```
if ( !class_exists( 'GP_Locales' ) ) {
if ( !defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) || !file_exists( JETPACK__GLOTPRESS_LOCALES_PATH ) ) {
return false;
}
require JETPACK__GLOTPRESS_LOCALES_PATH;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.