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
This commit is contained in:
John Blackbourn 2022-06-20 22:57:16 +00:00
parent a07f85a464
commit 721877d3d2
4 changed files with 22 additions and 13 deletions

View File

@ -823,7 +823,7 @@ function default_topic_count_scale( $count ) {
* 'DESC' (descending), or 'RAND' (random). Default 'ASC'. * 'DESC' (descending), or 'RAND' (random). Default 'ASC'.
* @type int|bool $filter Whether to enable filtering of the final output * @type int|bool $filter Whether to enable filtering of the final output
* via {@see 'wp_generate_tag_cloud'}. Default 1. * 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. * tag counts. Default null.
* @type callable $topic_count_text_callback Callback used to generate nooped plural text for * @type callable $topic_count_text_callback Callback used to generate nooped plural text for
* tag counts based on the count. Default null. * tag counts based on the count. Default null.

View File

@ -587,12 +587,12 @@ function _nx( $single, $plural, $number, $context, $domain = 'default' ) {
* @return array { * @return array {
* Array of translation information for the strings. * Array of translation information for the strings.
* *
* @type string $0 Singular form to be localized. No longer used. * @type string $0 Singular form to be localized. No longer used.
* @type string $1 Plural 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 $singular Singular form to be localized.
* @type string $plural Plural form to be localized. * @type string $plural Plural form to be localized.
* @type null $context Context information for the translators. * @type null $context Context information for the translators.
* @type string $domain Text domain. * @type string|null $domain Text domain.
* } * }
*/ */
function _n_noop( $singular, $plural, $domain = null ) { 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(). * with _n_noop() or _nx_noop().
* *
* Used when you want to use a translatable plural string once the number is known. * 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 * @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 int $count Number of objects.
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. If $nooped_plural contains * @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'. * 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' ) { function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) {
if ( $nooped_plural['domain'] ) { if ( $nooped_plural['domain'] ) {

View File

@ -1254,8 +1254,10 @@ function _wp_privacy_statuses() {
* *
* @type bool|string $label A descriptive name for the post status marked * @type bool|string $label A descriptive name for the post status marked
* for translation. Defaults to value of $post_status. * for translation. Defaults to value of $post_status.
* @type bool|array $label_count Descriptive text to use for nooped plurals. * @type array|false $label_count Nooped plural text from _n_noop() to provide the singular
* Default array of $label, twice. * 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 * @type bool $exclude_from_search Whether to exclude posts with this post status
* from search results. Default is value of $internal. * from search results. Default is value of $internal.
* @type bool $_builtin Whether the status is built-in. Core-use only. * @type bool $_builtin Whether the status is built-in. Core-use only.

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.