Make WordPress Core

Ticket #38791: 38791.1.diff

File 38791.1.diff, 8.2 KB (added by dimadin, 9 years ago)
  • wp-includes/rest-api.php

     
    10491049                                break;
    10501050                        case 'ipv4' :
    10511051                                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 ) );
    10531053                                }
    10541054                                break;
    10551055                }
     
    10581058        if ( in_array( $args['type'], array( 'number', 'integer' ), true ) && ( isset( $args['minimum'] ) || isset( $args['maximum'] ) ) ) {
    10591059                if ( isset( $args['minimum'] ) && ! isset( $args['maximum'] ) ) {
    10601060                        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'] ) );
    10621062                        } 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'] ) );
    10641064                        }
    10651065                } elseif ( isset( $args['maximum'] ) && ! isset( $args['minimum'] ) ) {
    10661066                        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'] ) );
    10681068                        } 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'] ) );
    10701070                        }
    10711071                } elseif ( isset( $args['maximum'] ) && isset( $args['minimum'] ) ) {
    10721072                        if ( ! empty( $args['exclusiveMinimum'] ) && ! empty( $args['exclusiveMaximum'] ) ) {
  • wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

     
    12231223                        $avatar_sizes = rest_get_avatar_sizes();
    12241224                        foreach ( $avatar_sizes as $size ) {
    12251225                                $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 ),
    12271227                                        'type'        => 'string',
    12281228                                        'format'      => 'uri',
    12291229                                        'context'     => array( 'embed', 'view', 'edit' ),
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

     
    19331933                foreach ( $taxonomies as $taxonomy ) {
    19341934                        $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
    19351935                        $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 ),
    19371937                                'type'        => 'array',
    19381938                                'items'       => array(
    19391939                                        'type'    => 'integer',
     
    20882088                        $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
    20892089
    20902090                        $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 ),
    20922092                                'type'              => 'array',
    20932093                                'items'             => array(
    20942094                                        'type'          => 'integer',
     
    20972097                        );
    20982098
    20992099                        $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 ),
    21012101                                'type'        => 'array',
    21022102                                'items'       => array(
    21032103                                        'type'    => 'integer',
  • wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

     
    974974                foreach ( $roles as $role ) {
    975975
    976976                        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 ) );
    978978                        }
    979979
    980980                        $potential_role = $wp_roles->role_objects[ $role ];
     
    12061206
    12071207                        foreach ( $avatar_sizes as $size ) {
    12081208                                $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 ),
    12101210                                        'type'        => 'string',
    12111211                                        'format'      => 'uri',
    12121212                                        'context'     => array( 'embed', 'view', 'edit' ),
  • wp-includes/rest-api/fields/class-wp-rest-meta-fields.php

     
    176176                if ( ! current_user_can( "delete_{$meta_type}_meta", $object_id, $name ) ) {
    177177                        return new WP_Error(
    178178                                '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 ),
    180180                                array( 'key' => $name, 'status' => rest_authorization_required_code() )
    181181                        );
    182182                }
     
    210210                if ( ! current_user_can( "edit_{$meta_type}_meta", $object_id, $name ) ) {
    211211                        return new WP_Error(
    212212                                '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 ),
    214214                                array( 'key' => $name, 'status' => rest_authorization_required_code() )
    215215                        );
    216216                }
     
    280280                if ( ! current_user_can(  "edit_{$meta_type}_meta", $object_id, $name ) ) {
    281281                        return new WP_Error(
    282282                                '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 ),
    284284                                array( 'key' => $name, 'status' => rest_authorization_required_code() )
    285285                        );
    286286                }