WordPress.org

Make WordPress Core

Changeset 39239


Ignore:
Timestamp:
11/15/2016 05:38:21 AM (19 months ago)
Author:
rmccue
Message:

REST API: Move translator comments to preceding line.

Inline translator comments break POT file generation.

Props dd32.
See #38791.

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

Legend:

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

    r39238 r39239  
    10001000        }
    10011001        if ( ! wp_is_numeric_array( $value ) ) {
    1002             return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: type name */ __( '%1$s is not of type %2$s.' ), $param, 'array' ) );
     1002            /* translators: 1: parameter, 2: type name */
     1003            return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'array' ) );
    10031004        }
    10041005        foreach ( $value as $index => $v ) {
     
    10111012    if ( ! empty( $args['enum'] ) ) {
    10121013        if ( ! in_array( $value, $args['enum'], true ) ) {
    1013             return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: list of valid values */ __( '%1$s is not one of %2$s.' ), $param, implode( ', ', $args['enum'] ) ) );
     1014            /* translators: 1: parameter, 2: list of valid values */
     1015            return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not one of %2$s.' ), $param, implode( ', ', $args['enum'] ) ) );
    10141016        }
    10151017    }
    10161018
    10171019    if ( in_array( $args['type'], array( 'integer', 'number' ) ) && ! is_numeric( $value ) ) {
    1018         return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: type name */ __( '%1$s is not of type %2$s.' ), $param, $args['type'] ) );
     1020        /* translators: 1: parameter, 2: type name */
     1021        return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, $args['type'] ) );
    10191022    }
    10201023
    10211024    if ( 'integer' === $args['type'] && round( floatval( $value ) ) !== floatval( $value ) ) {
    1022         return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: type name */ __( '%1$s is not of type %2$s.' ), $param, 'integer' ) );
     1025        /* translators: 1: parameter, 2: type name */
     1026        return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'integer' ) );
    10231027    }
    10241028
    10251029    if ( 'boolean' === $args['type'] && ! rest_is_boolean( $value ) ) {
    1026         return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: type name */ __( '%1$s is not of type %2$s.' ), $value, 'boolean' ) );
     1030        /* translators: 1: parameter, 2: type name */
     1031        return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $value, 'boolean' ) );
    10271032    }
    10281033
    10291034    if ( 'string' === $args['type'] && ! is_string( $value ) ) {
    1030         return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: type name */ __( '%1$s is not of type %2$s.' ), $param, 'string' ) );
     1035        /* translators: 1: parameter, 2: type name */
     1036        return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'string' ) );
    10311037    }
    10321038
     
    10501056            case 'ipv4' :
    10511057                if ( ! rest_is_ip_address( $value ) ) {
    1052                     return new WP_Error( 'rest_invalid_param', sprintf( __( /* translators: %s: IP address */ '%s is not a valid IP address.' ), $value ) );
     1058                    /* translators: %s: IP address */
     1059                    return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not a valid IP address.' ), $value ) );
    10531060                }
    10541061                break;
     
    10591066        if ( isset( $args['minimum'] ) && ! isset( $args['maximum'] ) ) {
    10601067            if ( ! empty( $args['exclusiveMinimum'] ) && $value <= $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'] ) );
     1068                /* translators: 1: parameter, 2: minimum number */
     1069                return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d (exclusive)' ), $param, $args['minimum'] ) );
    10621070            } elseif ( empty( $args['exclusiveMinimum'] ) && $value < $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'] ) );
     1071                /* translators: 1: parameter, 2: minimum number */
     1072                return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d (inclusive)' ), $param, $args['minimum'] ) );
    10641073            }
    10651074        } elseif ( isset( $args['maximum'] ) && ! isset( $args['minimum'] ) ) {
    10661075            if ( ! empty( $args['exclusiveMaximum'] ) && $value >= $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'] ) );
     1076                /* translators: 1: parameter, 2: maximum number */
     1077                return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d (exclusive)' ), $param, $args['maximum'] ) );
    10681078            } elseif ( empty( $args['exclusiveMaximum'] ) && $value > $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'] ) );
     1079                /* translators: 1: parameter, 2: maximum number */
     1080                return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d (inclusive)' ), $param, $args['maximum'] ) );
    10701081            }
    10711082        } elseif ( isset( $args['maximum'] ) && isset( $args['minimum'] ) ) {
    10721083            if ( ! empty( $args['exclusiveMinimum'] ) && ! empty( $args['exclusiveMaximum'] ) ) {
    10731084                if ( $value >= $args['maximum'] || $value <= $args['minimum'] ) {
    1074                     return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: minimum number, 3: maximum number */ __( '%1$s must be between %2$d (exclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
     1085                    /* translators: 1: parameter, 2: minimum number, 3: maximum number */
     1086                    return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be between %2$d (exclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
    10751087                }
    10761088            } elseif ( empty( $args['exclusiveMinimum'] ) && ! empty( $args['exclusiveMaximum'] ) ) {
    10771089                if ( $value >= $args['maximum'] || $value < $args['minimum'] ) {
    1078                     return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: minimum number, 3: maximum number */ __( '%1$s must be between %2$d (inclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
     1090                    /* translators: 1: parameter, 2: minimum number, 3: maximum number */
     1091                    return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be between %2$d (inclusive) and %3$d (exclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
    10791092                }
    10801093            } elseif ( ! empty( $args['exclusiveMinimum'] ) && empty( $args['exclusiveMaximum'] ) ) {
    10811094                if ( $value > $args['maximum'] || $value <= $args['minimum'] ) {
    1082                     return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: minimum number, 3: maximum number */ __( '%1$s must be between %2$d (exclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
     1095                    /* translators: 1: parameter, 2: minimum number, 3: maximum number */
     1096                    return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be between %2$d (exclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
    10831097                }
    10841098            } elseif ( empty( $args['exclusiveMinimum'] ) && empty( $args['exclusiveMaximum'] ) ) {
    10851099                if ( $value > $args['maximum'] || $value < $args['minimum'] ) {
    1086                     return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: minimum number, 3: maximum number */ __( '%1$s must be between %2$d (inclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
     1100                    /* translators: 1: parameter, 2: minimum number, 3: maximum number */
     1101                    return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be between %2$d (inclusive) and %3$d (inclusive)' ), $param, $args['minimum'], $args['maximum'] ) );
    10871102                }
    10881103            }
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r39238 r39239  
    12241224            foreach ( $avatar_sizes as $size ) {
    12251225                $avatar_properties[ $size ] = array(
    1226                     'description' => sprintf( __( /* translators: %d: avatar image size in pixels */ 'Avatar URL with image size of %d pixels.' ), $size ),
     1226                    /* translators: %d: avatar image size in pixels */
     1227                    'description' => sprintf( __( 'Avatar URL with image size of %d pixels.' ), $size ),
    12271228                    'type'        => 'string',
    12281229                    'format'      => 'uri',
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r39238 r39239  
    19341934            $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
    19351935            $schema['properties'][ $base ] = array(
    1936                 'description' => sprintf( __( /* translators: %s: taxonomy name */ 'The terms assigned to the object in the %s taxonomy.' ), $taxonomy->name ),
     1936                /* translators: %s: taxonomy name */
     1937                'description' => sprintf( __( 'The terms assigned to the object in the %s taxonomy.' ), $taxonomy->name ),
    19371938                'type'        => 'array',
    19381939                'items'       => array(
     
    20892090
    20902091            $params[ $base ] = array(
    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                /* translators: %s: taxonomy name */
     2093                'description'       => sprintf( __( 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ),
    20922094                'type'              => 'array',
    20932095                'items'             => array(
     
    20982100
    20992101            $params[ $base . '_exclude' ] = array(
    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 ),
     2102                /* translators: %s: taxonomy name */
     2103                'description' => sprintf( __( 'Limit result set to all items except those that have the specified term assigned in the %s taxonomy.' ), $base ),
    21012104                'type'        => 'array',
    21022105                'items'       => array(
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r39238 r39239  
    975975
    976976            if ( ! isset( $wp_roles->role_objects[ $role ] ) ) {
    977                 return new WP_Error( 'rest_user_invalid_role', sprintf( __( /* translators: %s: role key */ 'The role %s does not exist.' ), $role ), array( 'status' => 400 ) );
     977                /* translators: %s: role key */
     978                return new WP_Error( 'rest_user_invalid_role', sprintf( __( 'The role %s does not exist.' ), $role ), array( 'status' => 400 ) );
    978979            }
    979980
     
    12071208            foreach ( $avatar_sizes as $size ) {
    12081209                $avatar_properties[ $size ] = array(
    1209                     'description' => sprintf( __( /* translators: %d: avatar image size in pixels */ 'Avatar URL with image size of %d pixels.' ), $size ),
     1210                    /* translators: %d: avatar image size in pixels */
     1211                    'description' => sprintf( __( 'Avatar URL with image size of %d pixels.' ), $size ),
    12101212                    'type'        => 'string',
    12111213                    'format'      => 'uri',
Note: See TracChangeset for help on using the changeset viewer.