mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
REST API: Use _n()
in some error messages for proper plural forms support.
Follow-up to [47923], [49053]. Props audrasjb, tobifjellner, TimothyBlynJacobs, SergeyBiryukov. Fixes #51727. Built from https://develop.svn.wordpress.org/trunk@49536 git-svn-id: http://core.svn.wordpress.org/trunk@49274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ec9b010cea
commit
c66edd0439
@ -2009,13 +2009,35 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $args['minItems'] ) && count( $value ) < $args['minItems'] ) {
|
if ( isset( $args['minItems'] ) && count( $value ) < $args['minItems'] ) {
|
||||||
/* translators: 1: Parameter, 2: Number. */
|
return new WP_Error(
|
||||||
return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must contain at least %2$s items.' ), $param, number_format_i18n( $args['minItems'] ) ) );
|
'rest_invalid_param',
|
||||||
|
sprintf(
|
||||||
|
/* translators: 1: Parameter, 2: Number. */
|
||||||
|
_n(
|
||||||
|
'%1$s must contain at least %2$s item.',
|
||||||
|
'%1$s must contain at least %2$s items.',
|
||||||
|
$args['minItems']
|
||||||
|
),
|
||||||
|
$param,
|
||||||
|
number_format_i18n( $args['minItems'] )
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $args['maxItems'] ) && count( $value ) > $args['maxItems'] ) {
|
if ( isset( $args['maxItems'] ) && count( $value ) > $args['maxItems'] ) {
|
||||||
/* translators: 1: Parameter, 2: Number. */
|
return new WP_Error(
|
||||||
return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must contain at most %2$s items.' ), $param, number_format_i18n( $args['maxItems'] ) ) );
|
'rest_invalid_param',
|
||||||
|
sprintf(
|
||||||
|
/* translators: 1: Parameter, 2: Number. */
|
||||||
|
_n(
|
||||||
|
'%1$s must contain at most %2$s item.',
|
||||||
|
'%1$s must contain at most %2$s items.',
|
||||||
|
$args['maxItems']
|
||||||
|
),
|
||||||
|
$param,
|
||||||
|
number_format_i18n( $args['maxItems'] )
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $args['uniqueItems'] ) && ! rest_validate_array_contains_unique_items( $value ) ) {
|
if ( ! empty( $args['uniqueItems'] ) && ! rest_validate_array_contains_unique_items( $value ) ) {
|
||||||
@ -2086,13 +2108,35 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $args['minProperties'] ) && count( $value ) < $args['minProperties'] ) {
|
if ( isset( $args['minProperties'] ) && count( $value ) < $args['minProperties'] ) {
|
||||||
/* translators: 1: Parameter, 2: Number. */
|
return new WP_Error(
|
||||||
return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must contain at least %2$s properties.' ), $param, number_format_i18n( $args['minProperties'] ) ) );
|
'rest_invalid_param',
|
||||||
|
sprintf(
|
||||||
|
/* translators: 1: Parameter, 2: Number. */
|
||||||
|
_n(
|
||||||
|
'%1$s must contain at least %2$s property.',
|
||||||
|
'%1$s must contain at least %2$s properties.',
|
||||||
|
$args['minProperties']
|
||||||
|
),
|
||||||
|
$param,
|
||||||
|
number_format_i18n( $args['minProperties'] )
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $args['maxProperties'] ) && count( $value ) > $args['maxProperties'] ) {
|
if ( isset( $args['maxProperties'] ) && count( $value ) > $args['maxProperties'] ) {
|
||||||
/* translators: 1: Parameter, 2: Number. */
|
return new WP_Error(
|
||||||
return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must contain at most %2$s properties.' ), $param, number_format_i18n( $args['maxProperties'] ) ) );
|
'rest_invalid_param',
|
||||||
|
sprintf(
|
||||||
|
/* translators: 1: Parameter, 2: Number. */
|
||||||
|
_n(
|
||||||
|
'%1$s must contain at most %2$s property.',
|
||||||
|
'%1$s must contain at most %2$s properties.',
|
||||||
|
$args['maxProperties']
|
||||||
|
),
|
||||||
|
$param,
|
||||||
|
number_format_i18n( $args['maxProperties'] )
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.6-beta3-49535';
|
$wp_version = '5.6-beta3-49536';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user