Automattic / Automattic/jetpack

I18n: get_locale calls involve much boilerplate code

Open
#2,707 2 comments 0 reactions 1 assignee Claimed by @zinigor View on GitHub
[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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.