Make WordPress Core

Changeset 47306


Ignore:
Timestamp:
02/18/2020 04:46:11 PM (7 years ago)
Author:
desrosj
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r47254 r47306  
    18641864                                        __( 'The REST API request failed due to an error.' ),
    18651865                                        sprintf(
    1866                                                 /* translators: 1: The HTTP response code. 2: The error message returned. */
    1867                                                 __( 'Error: [%1$s] %2$s' ),
    1868                                                 wp_remote_retrieve_response_code( $r ),
    1869                                                 $r->get_error_message()
     1866                                                /* translators: 1: The WordPress error message. 2: The WordPress error code. */
     1867                                                __( 'Error: %1$s (%2$s)' ),
     1868                                                $r->get_error_message(),
     1869                                                $r->get_error_code()
    18701870                                        )
    18711871                                )
     
    18791879                                '<p>%s</p>',
    18801880                                sprintf(
    1881                                         /* translators: 1: The HTTP response code returned. 2: The error message returned. */
     1881                                        /* translators: 1: The HTTP error code. 2: The HTTP error message. */
    18821882                                        __( 'The REST API call gave the following unexpected result: (%1$d) %2$s.' ),
    18831883                                        wp_remote_retrieve_response_code( $r ),
     
    21862186                                        __( 'The loopback request to your site failed, this means features relying on them are not currently working as expected.' ),
    21872187                                        sprintf(
    2188                                                 /* translators: 1: The HTTP response code. 2: The error message returned. */
    2189                                                 __( 'Error: [%1$s] %2$s' ),
    2190                                                 wp_remote_retrieve_response_code( $r ),
    2191                                                 $r->get_error_message()
     2188                                                /* translators: 1: The WordPress error message. 2: The WordPress error code. */
     2189                                                __( 'Error: %1$s (%2$s)' ),
     2190                                                $r->get_error_message(),
     2191                                                $r->get_error_code()
    21922192                                        )
    21932193                                ),
Note: See TracChangeset for help on using the changeset viewer.