diff --git a/src/wp-includes/class-wp-locale.php b/src/wp-includes/class-wp-locale.php index 38b1860b89..140b93b482 100644 --- a/src/wp-includes/class-wp-locale.php +++ b/src/wp-includes/class-wp-locale.php @@ -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. diff --git a/src/wp-includes/l10n.php b/src/wp-includes/l10n.php index 52a51d5147..eb1a2cc5a9 100644 --- a/src/wp-includes/l10n.php +++ b/src/wp-includes/l10n.php @@ -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(); } diff --git a/tests/phpunit/tests/l10n/wpGetListItemSeparator.php b/tests/phpunit/tests/l10n/wpGetListItemSeparator.php new file mode 100644 index 0000000000..5fc3d9e6f3 --- /dev/null +++ b/tests/phpunit/tests/l10n/wpGetListItemSeparator.php @@ -0,0 +1,28 @@ +assertSame( __( ', ' ), $actual ); + } +} diff --git a/tests/phpunit/tests/l10n/wpGetWordCountType.php b/tests/phpunit/tests/l10n/wpGetWordCountType.php new file mode 100644 index 0000000000..3a4b032205 --- /dev/null +++ b/tests/phpunit/tests/l10n/wpGetWordCountType.php @@ -0,0 +1,28 @@ +assertSame( 'words', $actual ); + } +}