WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/16/2020 03:33:37 PM (14 months 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-includes/user.php

    r48049 r48059  
    135135
    136136        if ( empty( $username ) ) {
    137             $error->add( 'empty_username', __( '<strong>Error</strong>: The username field is empty.' ) );
     137            $error->add( 'empty_username', __( 'The username field is empty.' ) );
    138138        }
    139139
    140140        if ( empty( $password ) ) {
    141             $error->add( 'empty_password', __( '<strong>Error</strong>: The password field is empty.' ) );
     141            $error->add( 'empty_password', __( 'The password field is empty.' ) );
    142142        }
    143143
     
    173173            sprintf(
    174174                /* translators: %s: User name. */
    175                 __( '<strong>Error</strong>: The password you entered for the username %s is incorrect.' ),
     175                __( 'The password you entered for the username %s is incorrect.' ),
    176176                '<strong>' . $username . '</strong>'
    177177            ) .
     
    210210        if ( empty( $email ) ) {
    211211            // Uses 'empty_username' for back-compat with wp_signon().
    212             $error->add( 'empty_username', __( '<strong>Error</strong>: The email field is empty.' ) );
     212            $error->add( 'empty_username', __( 'The email field is empty.' ) );
    213213        }
    214214
    215215        if ( empty( $password ) ) {
    216             $error->add( 'empty_password', __( '<strong>Error</strong>: The password field is empty.' ) );
     216            $error->add( 'empty_password', __( 'The password field is empty.' ) );
    217217        }
    218218
     
    245245            sprintf(
    246246                /* translators: %s: Email address. */
    247                 __( '<strong>Error</strong>: The password you entered for the email address %s is incorrect.' ),
     247                __( 'The password you entered for the email address %s is incorrect.' ),
    248248                '<strong>' . $email . '</strong>'
    249249            ) .
     
    320320
    321321        if ( $spammed ) {
    322             return new WP_Error( 'spammer_account', __( '<strong>Error</strong>: Your account has been marked as a spammer.' ) );
     322            return new WP_Error( 'spammer_account', __( 'Your account has been marked as a spammer.' ) );
    323323        }
    324324    }
     
    22792279
    22802280    if ( ! ( $user instanceof WP_User ) ) {
    2281         return new WP_Error( 'invalidcombo', __( '<strong>Error</strong>: There is no account with that username or email address.' ) );
     2281        return new WP_Error( 'invalidcombo', __( 'There is no account with that username or email address.' ) );
    22822282    }
    22832283
     
    25082508    // Check the username.
    25092509    if ( '' === $sanitized_user_login ) {
    2510         $errors->add( 'empty_username', __( '<strong>Error</strong>: Please enter a username.' ) );
     2510        $errors->add( 'empty_username', __( 'Please enter a username.' ) );
    25112511    } elseif ( ! validate_username( $user_login ) ) {
    2512         $errors->add( 'invalid_username', __( '<strong>Error</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
     2512        $errors->add( 'invalid_username', __( 'This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
    25132513        $sanitized_user_login = '';
    25142514    } elseif ( username_exists( $sanitized_user_login ) ) {
    2515         $errors->add( 'username_exists', __( '<strong>Error</strong>: This username is already registered. Please choose another one.' ) );
     2515        $errors->add( 'username_exists', __( 'This username is already registered. Please choose another one.' ) );
    25162516
    25172517    } else {
     
    25192519        $illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() );
    25202520        if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ), true ) ) {
    2521             $errors->add( 'invalid_username', __( '<strong>Error</strong>: Sorry, that username is not allowed.' ) );
     2521            $errors->add( 'invalid_username', __( 'Sorry, that username is not allowed.' ) );
    25222522        }
    25232523    }
     
    25252525    // Check the email address.
    25262526    if ( '' === $user_email ) {
    2527         $errors->add( 'empty_email', __( '<strong>Error</strong>: Please type your email address.' ) );
     2527        $errors->add( 'empty_email', __( 'Please type your email address.' ) );
    25282528    } elseif ( ! is_email( $user_email ) ) {
    2529         $errors->add( 'invalid_email', __( '<strong>Error</strong>: The email address isn&#8217;t correct.' ) );
     2529        $errors->add( 'invalid_email', __( 'The email address isn&#8217;t correct.' ) );
    25302530        $user_email = '';
    25312531    } elseif ( email_exists( $user_email ) ) {
    2532         $errors->add( 'email_exists', __( '<strong>Error</strong>: This email is already registered, please choose another one.' ) );
     2532        $errors->add( 'email_exists', __( 'This email is already registered. Please choose another one.' ) );
    25332533    }
    25342534
     
    25752575            sprintf(
    25762576                /* translators: %s: Admin email address. */
    2577                 __( '<strong>Error</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">site admin</a>!' ),
     2577                __( 'Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">webmaster</a>!' ),
    25782578                get_option( 'admin_email' )
    25792579            )
     
    28102810            $errors->add(
    28112811                'user_email',
    2812                 __( '<strong>Error</strong>: The email address isn&#8217;t correct.' ),
     2812                __( 'The email address isn&#8217;t correct.' ),
    28132813                array(
    28142814                    'form-field' => 'email',
     
    28222822            $errors->add(
    28232823                'user_email',
    2824                 __( '<strong>Error</strong>: The email address is already used.' ),
     2824                __( 'The email address is already used.' ),
    28252825                array(
    28262826                    'form-field' => 'email',
Note: See TracChangeset for help on using the changeset viewer.