Make WordPress Core


Ignore:
Timestamp:
06/16/2020 03:33:37 PM (5 years ago)
Author:
afercia
Message:

I18N: Remove the "Error:" prefix from error messages.

For a number of years, most of the WordPress error messages have been prefixed with "Error:". However, these messages appear in a context where it's already clear an error occurred. Whether it's an error, a warning, or any other classification, that's not so relevant for users. The content of the message is the relevant part. The "Error:" prefix doesn't add great value while it does add unnecessary complexity for the message readability.

Also, revises some of these messages to improve clarity and removes HTML from translatable strings.

Props garrett-eclipse, ramiy, SergeyBiryukov, afercia, sabernhardt, quadthemes, audrasjb.
See #47003, #43037, #42945, #15887.
Fixes #47656.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/user.php

    r47808 r48059  
    144144    /* checking that username has been typed */
    145145    if ( '' === $user->user_login ) {
    146         $errors->add( 'user_login', __( '<strong>Error</strong>: Please enter a username.' ) );
     146        $errors->add( 'user_login', __( 'Please enter a username.' ) );
    147147    }
    148148
    149149    /* checking that nickname has been typed */
    150150    if ( $update && empty( $user->nickname ) ) {
    151         $errors->add( 'nickname', __( '<strong>Error</strong>: Please enter a nickname.' ) );
     151        $errors->add( 'nickname', __( 'Please enter a nickname.' ) );
    152152    }
    153153
     
    165165    // Check for blank password when adding a user.
    166166    if ( ! $update && empty( $pass1 ) ) {
    167         $errors->add( 'pass', __( '<strong>Error</strong>: Please enter a password.' ), array( 'form-field' => 'pass1' ) );
     167        $errors->add( 'pass', __( 'Please enter a password.' ), array( 'form-field' => 'pass1' ) );
    168168    }
    169169
    170170    // Check for "\" in password.
    171171    if ( false !== strpos( wp_unslash( $pass1 ), '\\' ) ) {
    172         $errors->add( 'pass', __( '<strong>Error</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) );
     172        $errors->add( 'pass', __( 'Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) );
    173173    }
    174174
    175175    // Checking the password has been typed twice the same.
    176176    if ( ( $update || ! empty( $pass1 ) ) && $pass1 != $pass2 ) {
    177         $errors->add( 'pass', __( '<strong>Error</strong>: Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) );
     177        $errors->add( 'pass', __( 'Passwords don&#8217;t match. Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) );
    178178    }
    179179
     
    183183
    184184    if ( ! $update && isset( $_POST['user_login'] ) && ! validate_username( $_POST['user_login'] ) ) {
    185         $errors->add( 'user_login', __( '<strong>Error</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
     185        $errors->add( 'user_login', __( 'This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
    186186    }
    187187
    188188    if ( ! $update && username_exists( $user->user_login ) ) {
    189         $errors->add( 'user_login', __( '<strong>Error</strong>: This username is already registered. Please choose another one.' ) );
     189        $errors->add( 'user_login', __( 'This username is already registered. Please choose another one.' ) );
    190190    }
    191191
     
    194194
    195195    if ( in_array( strtolower( $user->user_login ), array_map( 'strtolower', $illegal_logins ), true ) ) {
    196         $errors->add( 'invalid_username', __( '<strong>Error</strong>: Sorry, that username is not allowed.' ) );
     196        $errors->add( 'invalid_username', __( 'Sorry, that username is not allowed.' ) );
    197197    }
    198198
    199199    /* checking email address */
    200200    if ( empty( $user->user_email ) ) {
    201         $errors->add( 'empty_email', __( '<strong>Error</strong>: Please enter an email address.' ), array( 'form-field' => 'email' ) );
     201        $errors->add( 'empty_email', __( 'Please enter an email address.' ), array( 'form-field' => 'email' ) );
    202202    } elseif ( ! is_email( $user->user_email ) ) {
    203         $errors->add( 'invalid_email', __( '<strong>Error</strong>: The email address isn&#8217;t correct.' ), array( 'form-field' => 'email' ) );
     203        $errors->add( 'invalid_email', __( 'The email address isn&#8217;t correct.' ), array( 'form-field' => 'email' ) );
    204204    } else {
    205205        $owner_id = email_exists( $user->user_email );
    206206        if ( $owner_id && ( ! $update || ( $owner_id != $user->ID ) ) ) {
    207             $errors->add( 'email_exists', __( '<strong>Error</strong>: This email is already registered, please choose another one.' ), array( 'form-field' => 'email' ) );
     207            $errors->add( 'email_exists', __( 'This email is already registered. Please choose another one.' ), array( 'form-field' => 'email' ) );
    208208        }
    209209    }
Note: See TracChangeset for help on using the changeset viewer.