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.
Built from https://develop.svn.wordpress.org/trunk@47306


git-svn-id: http://core.svn.wordpress.org/trunk@47106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2020-02-18 16:48:06 +00:00
parent 306d804d86
commit 447536a0e6
2 changed files with 10 additions and 10 deletions

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()
)
),
);

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-beta1-47305';
$wp_version = '5.4-beta1-47306';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.