WordPress.org

Make WordPress Core

Changeset 39298


Ignore:
Timestamp:
11/18/16 20:20:01 (10 months ago)
Author:
joehoyle
Message:

REST API: Clarify parameters when used in error strings.

Properties of objects should not be translated, and therefore are pulled out of the translation strings.

Props ocean90, ramiy, danielbachhuber.
Fixes #38822.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r39296 r39298  
    374374        // Limit who can set comment `author` or `status` to anything other than the default. 
    375375        if ( isset( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( 'moderate_comments' ) ) { 
    376             return new WP_Error( 'rest_comment_invalid_author', __( 'Comment author invalid.' ), array( 'status' => rest_authorization_required_code() ) ); 
     376            /* translators: %s: request parameter */ 
     377            return new WP_Error( 'rest_comment_invalid_author', sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'author' ), array( 'status' => rest_authorization_required_code() ) ); 
    377378        } 
    378379 
    379380        if ( isset( $request['status'] ) && ! current_user_can( 'moderate_comments' ) ) { 
    380             return new WP_Error( 'rest_comment_invalid_status', __( 'Sorry, you are not allowed to set status for comments.' ), array( 'status' => rest_authorization_required_code() ) ); 
     381            /* translators: %s: request parameter */ 
     382            return new WP_Error( 'rest_comment_invalid_status', sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'status' ), array( 'status' => rest_authorization_required_code() ) ); 
    381383        } 
    382384 
Note: See TracChangeset for help on using the changeset viewer.