WordPress.org

Make WordPress Core

Changeset 39238


Ignore:
Timestamp:
11/15/16 04:27:49 (9 months ago)
Author:
rmccue
Message:

REST API: Add translator comments to text with placeholders.

Props dimadin.
Fixes #38791.

Location:
trunk/src/wp-includes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api.php

    r39222 r39238  
    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; 
     
    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'] ) ) { 
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r39223 r39238  
    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', 
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r39182 r39238  
    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( 
     
    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( 
     
    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( 
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r39223 r39238  
    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 
     
    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', 
  • trunk/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php

    r39222 r39238  
    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            ); 
     
    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            ); 
     
    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            ); 
Note: See TracChangeset for help on using the changeset viewer.