From 705f17cea279084127d4b9446928e78feea1f131 Mon Sep 17 00:00:00 2001 From: Ryan McCue Date: Tue, 15 Nov 2016 04:28:31 +0000 Subject: [PATCH] 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 --- wp-includes/rest-api.php | 10 +++++----- .../endpoints/class-wp-rest-comments-controller.php | 2 +- .../endpoints/class-wp-rest-posts-controller.php | 6 +++--- .../endpoints/class-wp-rest-users-controller.php | 4 ++-- .../rest-api/fields/class-wp-rest-meta-fields.php | 6 +++--- wp-includes/version.php | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php index 8e48f892f7..7f0cc4405b 100644 --- a/wp-includes/rest-api.php +++ b/wp-includes/rest-api.php @@ -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'] ) ) { diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index afd64895e1..ed0a702b17 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -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' ), diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index 11ae1ec798..a272e1083e 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -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', diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php index 0b49ec8a2c..06d3758a9c 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php @@ -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' ), diff --git a/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php b/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php index c4200a68d2..414f1bf2e7 100644 --- a/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php +++ b/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php @@ -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() ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 1dcb8152af..0b04f1308b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.