Make WordPress Core


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

REST API: Move translator comments to preceding line.

Inline translator comments break POT file generation.

Props dd32.
See #38791.

File:
1 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            }
Note: See TracChangeset for help on using the changeset viewer.