I18N: Restore the "Error:" prefix for error messages.

Partially reverts [48059] as there's no full consensus on the removal of the text prefix. Further actions should be taken to improve consistency and accessibility of the admin notices. Keeps some improvements to the translatable strings from [48059].

Fixes #47656.


git-svn-id: https://develop.svn.wordpress.org/trunk@48115 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia
2020-06-21 13:58:46 +00:00
parent e8176a19e2
commit 98d22d5d3d
25 changed files with 78 additions and 78 deletions
+1 -1
View File
@@ -255,7 +255,7 @@ final class WP_Theme implements ArrayAccess {
)
);
if ( ! file_exists( $this->theme_root ) ) { // Don't cache this one.
$this->errors->add( 'theme_root_missing', __( 'The themes directory is either empty or doesn’t exist. Please check your installation.' ) );
$this->errors->add( 'theme_root_missing', __( 'Error: The themes directory is either empty or doesn’t exist. Please check your installation.' ) );
}
return;
} elseif ( ! is_readable( $this->theme_root . '/' . $theme_file ) ) {
+8 -8
View File
@@ -1243,19 +1243,19 @@ function wp_check_comment_data_max_lengths( $comment_data ) {
$max_lengths = wp_get_comment_fields_max_lengths();
if ( isset( $comment_data['comment_author'] ) && mb_strlen( $comment_data['comment_author'], '8bit' ) > $max_lengths['comment_author'] ) {
return new WP_Error( 'comment_author_column_length', __( 'Your name is too long.' ), 200 );
return new WP_Error( 'comment_author_column_length', __( '<strong>Error</strong>: Your name is too long.' ), 200 );
}
if ( isset( $comment_data['comment_author_email'] ) && strlen( $comment_data['comment_author_email'] ) > $max_lengths['comment_author_email'] ) {
return new WP_Error( 'comment_author_email_column_length', __( 'Your email address is too long.' ), 200 );
return new WP_Error( 'comment_author_email_column_length', __( '<strong>Error</strong>: Your email address is too long.' ), 200 );
}
if ( isset( $comment_data['comment_author_url'] ) && strlen( $comment_data['comment_author_url'] ) > $max_lengths['comment_author_url'] ) {
return new WP_Error( 'comment_author_url_column_length', __( 'Your URL is too long.' ), 200 );
return new WP_Error( 'comment_author_url_column_length', __( '<strong>Error</strong>: Your URL is too long.' ), 200 );
}
if ( isset( $comment_data['comment_content'] ) && mb_strlen( $comment_data['comment_content'], '8bit' ) > $max_lengths['comment_content'] ) {
return new WP_Error( 'comment_content_column_length', __( 'Your comment is too long.' ), 200 );
return new WP_Error( 'comment_content_column_length', __( '<strong>Error</strong>: Your comment is too long.' ), 200 );
}
return true;
@@ -3398,9 +3398,9 @@ function wp_handle_comment_submission( $comment_data ) {
if ( get_option( 'require_name_email' ) && ! $user->exists() ) {
if ( '' == $comment_author_email || '' == $comment_author ) {
return new WP_Error( 'require_name_email', __( 'Please fill the required fields (name, email).' ), 200 );
return new WP_Error( 'require_name_email', __( '<strong>Error</strong>: Please fill the required fields (name, email).' ), 200 );
} elseif ( ! is_email( $comment_author_email ) ) {
return new WP_Error( 'require_valid_email', __( 'Please enter a valid email address.' ), 200 );
return new WP_Error( 'require_valid_email', __( '<strong>Error</strong>: Please enter a valid email address.' ), 200 );
}
}
@@ -3425,7 +3425,7 @@ function wp_handle_comment_submission( $comment_data ) {
*/
$allow_empty_comment = apply_filters( 'allow_empty_comment', false, $commentdata );
if ( '' === $comment_content && ! $allow_empty_comment ) {
return new WP_Error( 'require_valid_comment', __( 'Please type your comment text.' ), 200 );
return new WP_Error( 'require_valid_comment', __( '<strong>Error</strong>: Please type your comment text.' ), 200 );
}
$check_max_lengths = wp_check_comment_data_max_lengths( $commentdata );
@@ -3439,7 +3439,7 @@ function wp_handle_comment_submission( $comment_data ) {
}
if ( ! $comment_id ) {
return new WP_Error( 'comment_save_error', __( 'The comment could not be saved. Please try again later.' ), 500 );
return new WP_Error( 'comment_save_error', __( '<strong>Error</strong>: The comment could not be saved. Please try again later.' ), 500 );
}
return get_comment( $comment_id );
+1 -1
View File
@@ -1550,7 +1550,7 @@ function do_feed() {
}
if ( ! has_action( "do_feed_{$feed}" ) ) {
wp_die( __( 'This is not a valid feed template.' ), '', array( 'response' => 404 ) );
wp_die( __( 'Error: This is not a valid feed template.' ), '', array( 'response' => 404 ) );
}
/**
+1 -1
View File
@@ -548,7 +548,7 @@ function wp_set_wpdb_vars() {
wp_die(
sprintf(
/* translators: 1: $table_prefix, 2: wp-config.php */
__( '%1$s in %2$s can only contain numbers, letters, and underscores.' ),
__( '<strong>Error</strong>: %1$s in %2$s can only contain numbers, letters, and underscores.' ),
'<code>$table_prefix</code>',
'<code>wp-config.php</code>'
)
+2 -2
View File
@@ -401,7 +401,7 @@ function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
// Check if the domain has been used already. We should return an error message.
if ( domain_exists($domain, $path, $site_id) )
return __( 'Site URL you&#8217;ve entered is already taken.' );
return __( '<strong>Error</strong>: Site URL you&#8217;ve entered is already taken.' );
/*
* Need to back up wpdb table names, and create a new wp_blogs entry for new blog.
@@ -410,7 +410,7 @@ function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
*/
if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
return __( 'There was a problem creating site entry.' );
return __( '<strong>Error</strong>: There was a problem creating site entry.' );
switch_to_blog($blog_id);
install_blog($blog_id);
+1 -1
View File
@@ -547,7 +547,7 @@ if ( ! function_exists( 'wp_authenticate' ) ) :
if ( null == $user ) {
// TODO: What should the error message be? (Or would these even happen?)
// Only needed if all authentication handlers fail to return anything.
$user = new WP_Error( 'authentication_failed', __( 'Invalid username, email address or incorrect password.' ) );
$user = new WP_Error( 'authentication_failed', __( '<strong>Error</strong>: Invalid username, email address or incorrect password.' ) );
}
$ignore_codes = array( 'empty_username', 'empty_password' );
+3 -3
View File
@@ -929,7 +929,7 @@ function validate_theme_requirements( $stylesheet ) {
'theme_wp_php_incompatible',
sprintf(
/* translators: %s: Theme name. */
_x( 'Current WordPress and PHP versions do not meet minimum requirements for %s.', 'theme' ),
_x( '<strong>Error:</strong> Current WordPress and PHP versions do not meet minimum requirements for %s.', 'theme' ),
$theme->display( 'Name' )
)
);
@@ -938,7 +938,7 @@ function validate_theme_requirements( $stylesheet ) {
'theme_php_incompatible',
sprintf(
/* translators: %s: Theme name. */
_x( 'Current PHP version does not meet minimum requirements for %s.', 'theme' ),
_x( '<strong>Error:</strong> Current PHP version does not meet minimum requirements for %s.', 'theme' ),
$theme->display( 'Name' )
)
);
@@ -947,7 +947,7 @@ function validate_theme_requirements( $stylesheet ) {
'theme_wp_incompatible',
sprintf(
/* translators: %s: Theme name. */
_x( 'Current WordPress version does not meet minimum requirements for %s.', 'theme' ),
_x( '<strong>Error:</strong> Current WordPress version does not meet minimum requirements for %s.', 'theme' ),
$theme->display( 'Name' )
)
);
+18 -18
View File
@@ -134,11 +134,11 @@ function wp_authenticate_username_password( $user, $username, $password ) {
$error = new WP_Error();
if ( empty( $username ) ) {
$error->add( 'empty_username', __( 'The username field is empty.' ) );
$error->add( 'empty_username', __( '<strong>Error</strong>: The username field is empty.' ) );
}
if ( empty( $password ) ) {
$error->add( 'empty_password', __( 'The password field is empty.' ) );
$error->add( 'empty_password', __( '<strong>Error</strong>: The password field is empty.' ) );
}
return $error;
@@ -172,7 +172,7 @@ function wp_authenticate_username_password( $user, $username, $password ) {
'incorrect_password',
sprintf(
/* translators: %s: User name. */
__( 'The password you entered for the username %s is incorrect.' ),
__( '<strong>Error</strong>: The password you entered for the username %s is incorrect.' ),
'<strong>' . $username . '</strong>'
) .
' <a href="' . wp_lostpassword_url() . '">' .
@@ -209,11 +209,11 @@ function wp_authenticate_email_password( $user, $email, $password ) {
if ( empty( $email ) ) {
// Uses 'empty_username' for back-compat with wp_signon().
$error->add( 'empty_username', __( 'The email field is empty.' ) );
$error->add( 'empty_username', __( '<strong>Error</strong>: The email field is empty.' ) );
}
if ( empty( $password ) ) {
$error->add( 'empty_password', __( 'The password field is empty.' ) );
$error->add( 'empty_password', __( '<strong>Error</strong>: The password field is empty.' ) );
}
return $error;
@@ -244,7 +244,7 @@ function wp_authenticate_email_password( $user, $email, $password ) {
'incorrect_password',
sprintf(
/* translators: %s: Email address. */
__( 'The password you entered for the email address %s is incorrect.' ),
__( '<strong>Error</strong>: The password you entered for the email address %s is incorrect.' ),
'<strong>' . $email . '</strong>'
) .
' <a href="' . wp_lostpassword_url() . '">' .
@@ -319,7 +319,7 @@ function wp_authenticate_spam_check( $user ) {
$spammed = apply_filters( 'check_is_user_spammed', is_user_spammy( $user ), $user );
if ( $spammed ) {
return new WP_Error( 'spammer_account', __( 'Your account has been marked as a spammer.' ) );
return new WP_Error( 'spammer_account', __( '<strong>Error</strong>: Your account has been marked as a spammer.' ) );
}
}
return $user;
@@ -2283,7 +2283,7 @@ function get_password_reset_key( $user ) {
global $wp_hasher;
if ( ! ( $user instanceof WP_User ) ) {
return new WP_Error( 'invalidcombo', __( 'There is no account with that username or email address.' ) );
return new WP_Error( 'invalidcombo', __( '<strong>Error</strong>: There is no account with that username or email address.' ) );
}
/**
@@ -2512,29 +2512,29 @@ function register_new_user( $user_login, $user_email ) {
// Check the username.
if ( '' === $sanitized_user_login ) {
$errors->add( 'empty_username', __( 'Please enter a username.' ) );
$errors->add( 'empty_username', __( '<strong>Error</strong>: Please enter a username.' ) );
} elseif ( ! validate_username( $user_login ) ) {
$errors->add( 'invalid_username', __( 'This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
$errors->add( 'invalid_username', __( '<strong>Error</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
$sanitized_user_login = '';
} elseif ( username_exists( $sanitized_user_login ) ) {
$errors->add( 'username_exists', __( 'This username is already registered. Please choose another one.' ) );
$errors->add( 'username_exists', __( '<strong>Error</strong>: This username is already registered. Please choose another one.' ) );
} else {
/** This filter is documented in wp-includes/user.php */
$illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() );
if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ), true ) ) {
$errors->add( 'invalid_username', __( 'Sorry, that username is not allowed.' ) );
$errors->add( 'invalid_username', __( '<strong>Error</strong>: Sorry, that username is not allowed.' ) );
}
}
// Check the email address.
if ( '' === $user_email ) {
$errors->add( 'empty_email', __( 'Please type your email address.' ) );
$errors->add( 'empty_email', __( '<strong>Error</strong>: Please type your email address.' ) );
} elseif ( ! is_email( $user_email ) ) {
$errors->add( 'invalid_email', __( 'The email address isn&#8217;t correct.' ) );
$errors->add( 'invalid_email', __( '<strong>Error</strong>: The email address isn&#8217;t correct.' ) );
$user_email = '';
} elseif ( email_exists( $user_email ) ) {
$errors->add( 'email_exists', __( 'This email is already registered. Please choose another one.' ) );
$errors->add( 'email_exists', __( '<strong>Error</strong>: This email is already registered. Please choose another one.' ) );
}
/**
@@ -2579,7 +2579,7 @@ function register_new_user( $user_login, $user_email ) {
'registerfail',
sprintf(
/* translators: %s: Admin email address. */
__( 'Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">site admin</a>!' ),
__( '<strong>Error</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">site admin</a>!' ),
get_option( 'admin_email' )
)
);
@@ -2815,7 +2815,7 @@ function send_confirmation_on_profile_email() {
if ( ! is_email( $_POST['email'] ) ) {
$errors->add(
'user_email',
__( 'The email address isn&#8217;t correct.' ),
__( '<strong>Error</strong>: The email address isn&#8217;t correct.' ),
array(
'form-field' => 'email',
)
@@ -2827,7 +2827,7 @@ function send_confirmation_on_profile_email() {
if ( email_exists( $_POST['email'] ) ) {
$errors->add(
'user_email',
__( 'The email address is already used.' ),
__( '<strong>Error</strong>: The email address is already used.' ),
array(
'form-field' => 'email',
)
+1 -1
View File
@@ -3530,7 +3530,7 @@ class wpdb {
// Make sure the server has the required MySQL version.
if ( version_compare( $this->db_version(), $required_mysql_version, '<' ) ) {
/* translators: 1: WordPress version number, 2: Minimum required MySQL version number. */
return new WP_Error( 'database_version', sprintf( __( 'WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ) );
return new WP_Error( 'database_version', sprintf( __( '<strong>Error</strong>: WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ) );
}
}