REST API: Add translator comments to text with placeholders.
Props dimadin. Fixes #38791. Built from https://develop.svn.wordpress.org/trunk@39238 git-svn-id: http://core.svn.wordpress.org/trunk@39178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
de0835dead
commit
705f17cea2
|
@ -1049,7 +1049,7 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
|
|||
break;
|
||||
case 'ipv4' :
|
||||
if ( ! rest_is_ip_address( $value ) ) {
|
||||
return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not a valid IP address.' ), $value ) );
|
||||
return new WP_Error( 'rest_invalid_param', sprintf( __( /* translators: %s: IP address */ '%s is not a valid IP address.' ), $value ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1058,15 +1058,15 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
|
|||
if ( in_array( $args['type'], array( 'number', 'integer' ), true ) && ( isset( $args['minimum'] ) || isset( $args['maximum'] ) ) ) {
|
||||
if ( isset( $args['minimum'] ) && ! isset( $args['maximum'] ) ) {
|
||||
if ( ! empty( $args['exclusiveMinimum'] ) && $value <= $args['minimum'] ) {
|
||||
return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d (exclusive)' ), $param, $args['minimum'] ) );
|
||||
return new WP_Error( 'rest_invalid_param', sprintf( __( /* translators: 1: parameter, 2: minimum number */ '%1$s must be greater than %2$d (exclusive)' ), $param, $args['minimum'] ) );
|
||||
} elseif ( empty( $args['exclusiveMinimum'] ) && $value < $args['minimum'] ) {
|
||||
return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d (inclusive)' ), $param, $args['minimum'] ) );
|
||||
return new WP_Error( 'rest_invalid_param', sprintf( __( /* translators: 1: parameter, 2: minimum number */ '%1$s must be greater than %2$d (inclusive)' ), $param, $args['minimum'] ) );
|
||||
}
|
||||
} elseif ( isset( $args['maximum'] ) && ! isset( $args['minimum'] ) ) {
|
||||
if ( ! empty( $args['exclusiveMaximum'] ) && $value >= $args['maximum'] ) {
|
||||
return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d (exclusive)' ), $param, $args['maximum'] ) );
|
||||
return new WP_Error( 'rest_invalid_param', sprintf( __( /* translators: 1: parameter, 2: maximum number */ '%1$s must be less than %2$d (exclusive)' ), $param, $args['maximum'] ) );
|
||||
} elseif ( empty( $args['exclusiveMaximum'] ) && $value > $args['maximum'] ) {
|
||||
return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d (inclusive)' ), $param, $args['maximum'] ) );
|
||||
return new WP_Error( 'rest_invalid_param', sprintf( __( /* translators: 1: parameter, 2: maximum number */ '%1$s must be less than %2$d (inclusive)' ), $param, $args['maximum'] ) );
|
||||
}
|
||||
} elseif ( isset( $args['maximum'] ) && isset( $args['minimum'] ) ) {
|
||||
if ( ! empty( $args['exclusiveMinimum'] ) && ! empty( $args['exclusiveMaximum'] ) ) {
|
||||
|
|
|
@ -1223,7 +1223,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
|||
$avatar_sizes = rest_get_avatar_sizes();
|
||||
foreach ( $avatar_sizes as $size ) {
|
||||
$avatar_properties[ $size ] = array(
|
||||
'description' => sprintf( __( 'Avatar URL with image size of %d pixels.' ), $size ),
|
||||
'description' => sprintf( __( /* translators: %d: avatar image size in pixels */ 'Avatar URL with image size of %d pixels.' ), $size ),
|
||||
'type' => 'string',
|
||||
'format' => 'uri',
|
||||
'context' => array( 'embed', 'view', 'edit' ),
|
||||
|
|
|
@ -1933,7 +1933,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||
foreach ( $taxonomies as $taxonomy ) {
|
||||
$base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
|
||||
$schema['properties'][ $base ] = array(
|
||||
'description' => sprintf( __( 'The terms assigned to the object in the %s taxonomy.' ), $taxonomy->name ),
|
||||
'description' => sprintf( __( /* translators: %s: taxonomy name */ 'The terms assigned to the object in the %s taxonomy.' ), $taxonomy->name ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
|
@ -2088,7 +2088,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||
$base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
|
||||
|
||||
$params[ $base ] = array(
|
||||
'description' => sprintf( __( 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ),
|
||||
'description' => sprintf( __( /* translators: %s: taxonomy name */ 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
|
@ -2097,7 +2097,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||
);
|
||||
|
||||
$params[ $base . '_exclude' ] = array(
|
||||
'description' => sprintf( __( 'Limit result set to all items except those that have the specified term assigned in the %s taxonomy.' ), $base ),
|
||||
'description' => sprintf( __( /* translators: %s: taxonomy name */ 'Limit result set to all items except those that have the specified term assigned in the %s taxonomy.' ), $base ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
|
|
|
@ -974,7 +974,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
|||
foreach ( $roles as $role ) {
|
||||
|
||||
if ( ! isset( $wp_roles->role_objects[ $role ] ) ) {
|
||||
return new WP_Error( 'rest_user_invalid_role', sprintf( __( 'The role %s does not exist.' ), $role ), array( 'status' => 400 ) );
|
||||
return new WP_Error( 'rest_user_invalid_role', sprintf( __( /* translators: %s: role key */ 'The role %s does not exist.' ), $role ), array( 'status' => 400 ) );
|
||||
}
|
||||
|
||||
$potential_role = $wp_roles->role_objects[ $role ];
|
||||
|
@ -1206,7 +1206,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
|||
|
||||
foreach ( $avatar_sizes as $size ) {
|
||||
$avatar_properties[ $size ] = array(
|
||||
'description' => sprintf( __( 'Avatar URL with image size of %d pixels.' ), $size ),
|
||||
'description' => sprintf( __( /* translators: %d: avatar image size in pixels */ 'Avatar URL with image size of %d pixels.' ), $size ),
|
||||
'type' => 'string',
|
||||
'format' => 'uri',
|
||||
'context' => array( 'embed', 'view', 'edit' ),
|
||||
|
|
|
@ -176,7 +176,7 @@ abstract class WP_REST_Meta_Fields {
|
|||
if ( ! current_user_can( "delete_{$meta_type}_meta", $object_id, $name ) ) {
|
||||
return new WP_Error(
|
||||
'rest_cannot_delete',
|
||||
sprintf( __( 'You do not have permission to edit the %s custom field.' ), $name ),
|
||||
sprintf( __( /* translators: %s: custom field key */ 'You do not have permission to edit the %s custom field.' ), $name ),
|
||||
array( 'key' => $name, 'status' => rest_authorization_required_code() )
|
||||
);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ abstract class WP_REST_Meta_Fields {
|
|||
if ( ! current_user_can( "edit_{$meta_type}_meta", $object_id, $name ) ) {
|
||||
return new WP_Error(
|
||||
'rest_cannot_update',
|
||||
sprintf( __( 'You do not have permission to edit the %s custom field.' ), $name ),
|
||||
sprintf( __( /* translators: %s: custom field key */ 'You do not have permission to edit the %s custom field.' ), $name ),
|
||||
array( 'key' => $name, 'status' => rest_authorization_required_code() )
|
||||
);
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ abstract class WP_REST_Meta_Fields {
|
|||
if ( ! current_user_can( "edit_{$meta_type}_meta", $object_id, $name ) ) {
|
||||
return new WP_Error(
|
||||
'rest_cannot_update',
|
||||
sprintf( __( 'You do not have permission to edit the %s custom field.' ), $name ),
|
||||
sprintf( __( /* translators: %s: custom field key */ 'You do not have permission to edit the %s custom field.' ), $name ),
|
||||
array( 'key' => $name, 'status' => rest_authorization_required_code() )
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-beta3-39237';
|
||||
$wp_version = '4.7-beta3-39238';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue