diff --git a/wp-admin/error.php b/wp-admin/error.php index 07858be6f..0ea6a5bd8 100644 --- a/wp-admin/error.php +++ b/wp-admin/error.php @@ -15,12 +15,14 @@ switch ( isset( $_REQUEST['code'] ) ? sanitize_key( $_REQUEST['code'] ) : null ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.NoNonceVerification case 'offline': $title_prefix = __( 'Offline', 'pwa' ); - $content = sprintf( '
%s
', esc_html__( 'Please check your internet connection. In the future, this error screen could provide you with actions you can perform while offline, like edit recent drafts in Gutenberg.', 'pwa' ) ); + $content = sprintf( '%s
', esc_html__( 'In the future, this error screen could provide you with actions you can perform while offline, like edit recent drafts in Gutenberg.', 'pwa' ) ); break; case '500': $title_prefix = __( 'Internal Server Error', 'pwa' ); $content = sprintf( '%s
', esc_html__( 'Something went wrong which prevented WordPress from serving a response. Please check your error logs.', 'pwa' ) diff --git a/wp-includes/js/service-worker-navigation-routing.js b/wp-includes/js/service-worker-navigation-routing.js index a0c7be38b..619137403 100644 --- a/wp-includes/js/service-worker-navigation-routing.js +++ b/wp-includes/js/service-worker-navigation-routing.js @@ -91,7 +91,6 @@ ERROR_OFFLINE_BODY_FRAGMENT_URL, STREAM_HEADER_FRAGMENT_QUERY_VAR, NAVIGATION_BL return details; } ); - return new Response( body, init ); } ); } ); @@ -111,7 +110,7 @@ ERROR_OFFLINE_BODY_FRAGMENT_URL, STREAM_HEADER_FRAGMENT_QUERY_VAR, NAVIGATION_BL headers: response.headers }; - const body = text.replace( /[<]!--WP_SERVICE_WORKER_ERROR_MESSAGE-->/, errorMessages.default ); + const body = text.replace( /[<]!--WP_SERVICE_WORKER_ERROR_MESSAGE-->/, navigator.onLine ? errorMessages.serverOffline : errorMessages.clientOffline ); return new Response( body, init ); } ); diff --git a/wp-includes/template.php b/wp-includes/template.php index ee32bfe55..ff00a49cc 100644 --- a/wp-includes/template.php +++ b/wp-includes/template.php @@ -138,9 +138,10 @@ function wp_service_worker_get_error_messages() { return apply_filters( 'wp_service_worker_error_messages', array( - 'default' => __( 'Please check your internet connection, and try again.', 'pwa' ), - 'error' => __( 'Something prevented the page from being rendered. Please try again.', 'pwa' ), - 'comment' => __( 'Your comment will be submitted once you are back online!', 'pwa' ), + 'clientOffline' => __( 'It seems you are offline. Please check your internet connection and try again.', 'pwa' ), + 'serverOffline' => __( 'The server appears to be down. Please try again later.', 'pwa' ), + 'error' => __( 'Something prevented the page from being rendered. Please try again.', 'pwa' ), + 'comment' => __( 'Your comment will be submitted once you are back online!', 'pwa' ), ) ); } diff --git a/wp-includes/theme-compat/offline.php b/wp-includes/theme-compat/offline.php index 69f0c4fdc..1453c8dbc 100644 --- a/wp-includes/theme-compat/offline.php +++ b/wp-includes/theme-compat/offline.php @@ -14,7 +14,7 @@ ?>