diff --git a/includes/class-options-general.php b/includes/class-options-general.php index bfd6f82..2d1d371 100644 --- a/includes/class-options-general.php +++ b/includes/class-options-general.php @@ -150,7 +150,7 @@ public function core_version_check_locale( $wp_locale ) { $locale = Translations_API::locale( $wp_locale ); // If the current locale has no Language Packs, set the core update to default 'en_US'. - if ( ! isset( $locale->translations ) ) { + if ( is_null( $locale->translations ) ) { $wp_locale = 'en_US'; } @@ -193,7 +193,7 @@ public function settings_language_field_description() { // Get the formated Locale name. $formated_name = self::locale_name_format( $locale ); - if ( isset( $locale->translations ) ) { + if ( ! is_null( $locale->translations ) ) { // Format Locale name. $locales_with_lang_packs[] = $formated_name; } else { diff --git a/includes/class-site-health-test-wordpress-translations-locale.php b/includes/class-site-health-test-wordpress-translations-locale.php index 151f86e..e2c9733 100644 --- a/includes/class-site-health-test-wordpress-translations-locale.php +++ b/includes/class-site-health-test-wordpress-translations-locale.php @@ -90,7 +90,7 @@ public function run_test() { $translation_project_version = Translations_API::major_version( $translation_project['data']->name ); // Get translation project major version. - if ( isset( $locale->translations ) ) { + if ( ! is_null( $locale->translations ) ) { $locale_translations_version = Translations_API::major_version( $locale->translations['version'] ); } @@ -98,7 +98,7 @@ public function run_test() { $formated_name = Options_General::locale_name_format( $locale ); // Check if Language Packs exist for the Locale and if the Language Pack major version is the same as the WordPress installed major version. - if ( isset( $locale->translations ) && isset( $locale_translations_version ) && $translation_project_version === $locale_translations_version ) { + if ( ! is_null( $locale->translations ) && isset( $locale_translations_version ) && $translation_project_version === $locale_translations_version ) { $this->test_status = self::TRANSLATION_TOOLS_SITE_HEALTH_STATUS_GOOD; $this->test_label = sprintf( diff --git a/includes/class-site-health.php b/includes/class-site-health.php index 6262f7b..6f1877f 100644 --- a/includes/class-site-health.php +++ b/includes/class-site-health.php @@ -86,11 +86,11 @@ public static function locale_lang_pack_status( $wp_locale ) { if ( 'en_US' === $wp_locale ) { - $locale = esc_html__( 'WordPress default language, has no translation.', 'translation-tools' ); + return esc_html__( 'WordPress default language, has no translation.', 'translation-tools' ); - } elseif ( isset( $locale->translations ) ) { + } elseif ( ! is_null( $locale->translations ) ) { - $locale = sprintf( + return sprintf( /* translators: %s: Locale name. */ esc_html__( '%s has Language Packs.', 'translation-tools' ), $formated_name @@ -98,15 +98,13 @@ public static function locale_lang_pack_status( $wp_locale ) { } else { - $locale = sprintf( + return sprintf( /* translators: %s: Locale name. */ esc_html__( '%s has no Language Packs.', 'translation-tools' ), $formated_name ); } - - return $locale; } } diff --git a/includes/class-update-core.php b/includes/class-update-core.php index 4b4024c..2153e1d 100644 --- a/includes/class-update-core.php +++ b/includes/class-update-core.php @@ -271,7 +271,7 @@ public function update_core_bottom_section_content() { foreach ( $locales as $locale ) { - if ( isset( $locale->translations ) ) { + if ( ! is_null( $locale->translations ) ) { $locale_translations_version = Translations_API::major_version( $locale->translations['version'] ); } @@ -279,7 +279,7 @@ public function update_core_bottom_section_content() { $formated_name = Options_General::locale_name_format( $locale ); // Check if Language Packs exist for the Locale and if the Language Pack major version is the same as the WordPress installed major version. - if ( isset( $locale->translations ) && isset( $locale_translations_version ) && $translation_project_version === $locale_translations_version ) { + if ( ! is_null( $locale->translations ) && isset( $locale_translations_version ) && $translation_project_version === $locale_translations_version ) { $notice_messages[] = sprintf( wp_kses_post(