From 721877d3d2768fe21356de932caea871f4fe3739 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 20 Jun 2022 22:57:16 +0000 Subject: [PATCH] I18N: Correct and improve inline docs and tests for functionality related to nooped plurals. See #55646, #55652 Built from https://develop.svn.wordpress.org/trunk@53543 git-svn-id: http://core.svn.wordpress.org/trunk@53132 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/category-template.php | 2 +- wp-includes/l10n.php | 25 ++++++++++++++++--------- wp-includes/post.php | 6 ++++-- wp-includes/version.php | 2 +- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 250c5d378f..326b90771b 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -823,7 +823,7 @@ function default_topic_count_scale( $count ) { * 'DESC' (descending), or 'RAND' (random). Default 'ASC'. * @type int|bool $filter Whether to enable filtering of the final output * via {@see 'wp_generate_tag_cloud'}. Default 1. - * @type string $topic_count_text Nooped plural text from _n_noop() to supply to + * @type array $topic_count_text Nooped plural text from _n_noop() to supply to * tag counts. Default null. * @type callable $topic_count_text_callback Callback used to generate nooped plural text for * tag counts based on the count. Default null. diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index fd817ed067..c68fd8a897 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -587,12 +587,12 @@ function _nx( $single, $plural, $number, $context, $domain = 'default' ) { * @return array { * Array of translation information for the strings. * - * @type string $0 Singular form to be localized. No longer used. - * @type string $1 Plural form to be localized. No longer used. - * @type string $singular Singular form to be localized. - * @type string $plural Plural form to be localized. - * @type null $context Context information for the translators. - * @type string $domain Text domain. + * @type string $0 Singular form to be localized. No longer used. + * @type string $1 Plural form to be localized. No longer used. + * @type string $singular Singular form to be localized. + * @type string $plural Plural form to be localized. + * @type null $context Context information for the translators. + * @type string|null $domain Text domain. * } */ function _n_noop( $singular, $plural, $domain = null ) { @@ -654,7 +654,7 @@ function _nx_noop( $singular, $plural, $context, $domain = null ) { } /** - * Translates and retrieves the singular or plural form of a string that's been registered + * Translates and returns the singular or plural form of a string that's been registered * with _n_noop() or _nx_noop(). * * Used when you want to use a translatable plural string once the number is known. @@ -667,11 +667,18 @@ function _nx_noop( $singular, $plural, $context, $domain = null ) { * * @since 3.1.0 * - * @param array $nooped_plural Array with singular, plural, and context keys, usually the result of _n_noop() or _nx_noop(). + * @param array $nooped_plural { + * Array that is usually a return value from _n_noop() or _nx_noop(). + * + * @type string $singular Singular form to be localized. + * @type string $plural Plural form to be localized. + * @type string|null $context Context information for the translators. + * @type string|null $domain Text domain. + * } * @param int $count Number of objects. * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. If $nooped_plural contains * a text domain passed to _n_noop() or _nx_noop(), it will override this value. Default 'default'. - * @return string Either $single or $plural translated text. + * @return string Either $singular or $plural translated text. */ function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) { if ( $nooped_plural['domain'] ) { diff --git a/wp-includes/post.php b/wp-includes/post.php index 07dd58980e..cbf3e6e59a 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1254,8 +1254,10 @@ function _wp_privacy_statuses() { * * @type bool|string $label A descriptive name for the post status marked * for translation. Defaults to value of $post_status. - * @type bool|array $label_count Descriptive text to use for nooped plurals. - * Default array of $label, twice. + * @type array|false $label_count Nooped plural text from _n_noop() to provide the singular + * and plural forms of the label for counts. Default false + * which means the `$label` argument will be used for both + * the singular and plural forms of this label. * @type bool $exclude_from_search Whether to exclude posts with this post status * from search results. Default is value of $internal. * @type bool $_builtin Whether the status is built-in. Core-use only. diff --git a/wp-includes/version.php b/wp-includes/version.php index 9d91f1390b..4e75a4ccb4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53542'; +$wp_version = '6.1-alpha-53543'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.