Ticket #38791: 38791.1.diff
File 38791.1.diff, 8.2 KB (added by , 9 years ago) |
---|
-
wp-includes/rest-api.php
1049 1049 break; 1050 1050 case 'ipv4' : 1051 1051 if ( ! rest_is_ip_address( $value ) ) { 1052 return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not a valid IP address.' ), $value ) );1052 return new WP_Error( 'rest_invalid_param', sprintf( __( /* translators: %s: IP address */ '%s is not a valid IP address.' ), $value ) ); 1053 1053 } 1054 1054 break; 1055 1055 } … … 1058 1058 if ( in_array( $args['type'], array( 'number', 'integer' ), true ) && ( isset( $args['minimum'] ) || isset( $args['maximum'] ) ) ) { 1059 1059 if ( isset( $args['minimum'] ) && ! isset( $args['maximum'] ) ) { 1060 1060 if ( ! empty( $args['exclusiveMinimum'] ) && $value <= $args['minimum'] ) { 1061 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d (exclusive)' ), $param, $args['minimum'] ) );1061 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'] ) ); 1062 1062 } elseif ( empty( $args['exclusiveMinimum'] ) && $value < $args['minimum'] ) { 1063 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d (inclusive)' ), $param, $args['minimum'] ) );1063 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'] ) ); 1064 1064 } 1065 1065 } elseif ( isset( $args['maximum'] ) && ! isset( $args['minimum'] ) ) { 1066 1066 if ( ! empty( $args['exclusiveMaximum'] ) && $value >= $args['maximum'] ) { 1067 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d (exclusive)' ), $param, $args['maximum'] ) );1067 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'] ) ); 1068 1068 } elseif ( empty( $args['exclusiveMaximum'] ) && $value > $args['maximum'] ) { 1069 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d (inclusive)' ), $param, $args['maximum'] ) );1069 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'] ) ); 1070 1070 } 1071 1071 } elseif ( isset( $args['maximum'] ) && isset( $args['minimum'] ) ) { 1072 1072 if ( ! empty( $args['exclusiveMinimum'] ) && ! empty( $args['exclusiveMaximum'] ) ) { -
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
1223 1223 $avatar_sizes = rest_get_avatar_sizes(); 1224 1224 foreach ( $avatar_sizes as $size ) { 1225 1225 $avatar_properties[ $size ] = array( 1226 'description' => sprintf( __( 'Avatar URL with image size of %d pixels.' ), $size ),1226 'description' => sprintf( __( /* translators: %d: avatar image size in pixels */ 'Avatar URL with image size of %d pixels.' ), $size ), 1227 1227 'type' => 'string', 1228 1228 'format' => 'uri', 1229 1229 'context' => array( 'embed', 'view', 'edit' ), -
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
1933 1933 foreach ( $taxonomies as $taxonomy ) { 1934 1934 $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name; 1935 1935 $schema['properties'][ $base ] = array( 1936 'description' => sprintf( __( 'The terms assigned to the object in the %s taxonomy.' ), $taxonomy->name ),1936 'description' => sprintf( __( /* translators: %s: taxonomy name */ 'The terms assigned to the object in the %s taxonomy.' ), $taxonomy->name ), 1937 1937 'type' => 'array', 1938 1938 'items' => array( 1939 1939 'type' => 'integer', … … 2088 2088 $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name; 2089 2089 2090 2090 $params[ $base ] = array( 2091 'description' => sprintf( __( 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ),2091 'description' => sprintf( __( /* translators: %s: taxonomy name */ 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ), 2092 2092 'type' => 'array', 2093 2093 'items' => array( 2094 2094 'type' => 'integer', … … 2097 2097 ); 2098 2098 2099 2099 $params[ $base . '_exclude' ] = array( 2100 'description' => sprintf( __( 'Limit result set to all items except those that have the specified term assigned in the %s taxonomy.' ), $base ),2100 '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 ), 2101 2101 'type' => 'array', 2102 2102 'items' => array( 2103 2103 'type' => 'integer', -
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
974 974 foreach ( $roles as $role ) { 975 975 976 976 if ( ! isset( $wp_roles->role_objects[ $role ] ) ) { 977 return new WP_Error( 'rest_user_invalid_role', sprintf( __( 'The role %s does not exist.' ), $role ), array( 'status' => 400 ) );977 return new WP_Error( 'rest_user_invalid_role', sprintf( __( /* translators: %s: role key */ 'The role %s does not exist.' ), $role ), array( 'status' => 400 ) ); 978 978 } 979 979 980 980 $potential_role = $wp_roles->role_objects[ $role ]; … … 1206 1206 1207 1207 foreach ( $avatar_sizes as $size ) { 1208 1208 $avatar_properties[ $size ] = array( 1209 'description' => sprintf( __( 'Avatar URL with image size of %d pixels.' ), $size ),1209 'description' => sprintf( __( /* translators: %d: avatar image size in pixels */ 'Avatar URL with image size of %d pixels.' ), $size ), 1210 1210 'type' => 'string', 1211 1211 'format' => 'uri', 1212 1212 'context' => array( 'embed', 'view', 'edit' ), -
wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
176 176 if ( ! current_user_can( "delete_{$meta_type}_meta", $object_id, $name ) ) { 177 177 return new WP_Error( 178 178 'rest_cannot_delete', 179 sprintf( __( 'You do not have permission to edit the %s custom field.' ), $name ),179 sprintf( __( /* translators: %s: custom field key */ 'You do not have permission to edit the %s custom field.' ), $name ), 180 180 array( 'key' => $name, 'status' => rest_authorization_required_code() ) 181 181 ); 182 182 } … … 210 210 if ( ! current_user_can( "edit_{$meta_type}_meta", $object_id, $name ) ) { 211 211 return new WP_Error( 212 212 'rest_cannot_update', 213 sprintf( __( 'You do not have permission to edit the %s custom field.' ), $name ),213 sprintf( __( /* translators: %s: custom field key */ 'You do not have permission to edit the %s custom field.' ), $name ), 214 214 array( 'key' => $name, 'status' => rest_authorization_required_code() ) 215 215 ); 216 216 } … … 280 280 if ( ! current_user_can( "edit_{$meta_type}_meta", $object_id, $name ) ) { 281 281 return new WP_Error( 282 282 'rest_cannot_update', 283 sprintf( __( 'You do not have permission to edit the %s custom field.' ), $name ),283 sprintf( __( /* translators: %s: custom field key */ 'You do not have permission to edit the %s custom field.' ), $name ), 284 284 array( 'key' => $name, 'status' => rest_authorization_required_code() ) 285 285 ); 286 286 }