I18N: Check that `$wp_locale` global is set before calling its methods.
This avoids a fatal error if these functions are called in a mu-plugin before `$wp_locale` is set: * `wp_get_list_item_separator()` * `wp_get_word_count_type()` Follow-up to [52929], [52933], [55279], [55295]. Props kraftbj. Fixes #56698. Built from https://develop.svn.wordpress.org/trunk@55351 git-svn-id: http://core.svn.wordpress.org/trunk@54884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ae9744d1cc
commit
f8dd6946fc
|
@ -235,7 +235,7 @@ class WP_Locale {
|
|||
|
||||
$this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point;
|
||||
|
||||
/* translators: used between list items, there is a space after the comma */
|
||||
/* translators: Used between list items, there is a space after the comma. */
|
||||
$this->list_item_separator = __( ', ' );
|
||||
|
||||
// Set text direction.
|
||||
|
|
|
@ -1807,6 +1807,12 @@ function translate_settings_using_i18n_schema( $i18n_schema, $settings, $textdom
|
|||
function wp_get_list_item_separator() {
|
||||
global $wp_locale;
|
||||
|
||||
if ( ! ( $wp_locale instanceof WP_Locale ) ) {
|
||||
// Default value of WP_Locale::get_list_item_separator().
|
||||
/* translators: Used between list items, there is a space after the comma. */
|
||||
return __( ', ' );
|
||||
}
|
||||
|
||||
return $wp_locale->get_list_item_separator();
|
||||
}
|
||||
|
||||
|
@ -1823,5 +1829,10 @@ function wp_get_list_item_separator() {
|
|||
function wp_get_word_count_type() {
|
||||
global $wp_locale;
|
||||
|
||||
if ( ! ( $wp_locale instanceof WP_Locale ) ) {
|
||||
// Default value of WP_Locale::get_word_count_type().
|
||||
return 'words';
|
||||
}
|
||||
|
||||
return $wp_locale->get_word_count_type();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.2-beta2-55350';
|
||||
$wp_version = '6.2-beta2-55351';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue