Site Health: Display the REST API test error codes correctly.

This change fixes an issue where the error codes associated with failed REST API tests are not being printed to the screen. In addition, the square brackets have been replaced with parentheses for consistency, and the error code (which is much less useful to end-users than the error message itself) has been moved to the end of the line.

This also clarifies the associated translator comments.

Props afercia, desrosj.
Fixes #49426.

git-svn-id: https://develop.svn.wordpress.org/trunk@47306 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2020-02-18 16:46:11 +00:00
parent 6234fd90c2
commit b797e91541

View File

@ -1863,10 +1863,10 @@ class WP_Site_Health {
'%s<br>%s',
__( 'The REST API request failed due to an error.' ),
sprintf(
/* translators: 1: The HTTP response code. 2: The error message returned. */
__( 'Error: [%1$s] %2$s' ),
wp_remote_retrieve_response_code( $r ),
$r->get_error_message()
/* translators: 1: The WordPress error message. 2: The WordPress error code. */
__( 'Error: %1$s (%2$s)' ),
$r->get_error_message(),
$r->get_error_code()
)
)
);
@ -1878,7 +1878,7 @@ class WP_Site_Health {
$result['description'] .= sprintf(
'<p>%s</p>',
sprintf(
/* translators: 1: The HTTP response code returned. 2: The error message returned. */
/* translators: 1: The HTTP error code. 2: The HTTP error message. */
__( 'The REST API call gave the following unexpected result: (%1$d) %2$s.' ),
wp_remote_retrieve_response_code( $r ),
wp_remote_retrieve_body( $r )
@ -2185,10 +2185,10 @@ class WP_Site_Health {
'%s<br>%s',
__( 'The loopback request to your site failed, this means features relying on them are not currently working as expected.' ),
sprintf(
/* translators: 1: The HTTP response code. 2: The error message returned. */
__( 'Error: [%1$s] %2$s' ),
wp_remote_retrieve_response_code( $r ),
$r->get_error_message()
/* translators: 1: The WordPress error message. 2: The WordPress error code. */
__( 'Error: %1$s (%2$s)' ),
$r->get_error_message(),
$r->get_error_code()
)
),
);