From 1b2ed70f397369a6d6717a3af65848d69e101437 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 21 Nov 2016 01:52:32 +0000 Subject: [PATCH] I18N: Move the support forums URL in update-related HTTP API error messages to a separate translatable string that is already used elsewhere. Props ramiy, SergeyBiryukov. Fixes #38880. Built from https://develop.svn.wordpress.org/trunk@39325 git-svn-id: http://core.svn.wordpress.org/trunk@39265 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/plugin-install.php | 30 ++++++++++++++++++++--- wp-admin/includes/theme.php | 30 ++++++++++++++++++++--- wp-admin/includes/translation-install.php | 27 +++++++++++++++++--- wp-admin/includes/update.php | 9 ++++++- wp-admin/theme-install.php | 6 ++++- wp-includes/update.php | 27 +++++++++++++++++--- wp-includes/version.php | 2 +- 7 files changed, 114 insertions(+), 17 deletions(-) diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php index 9067446cf6..0d932c2618 100644 --- a/wp-admin/includes/plugin-install.php +++ b/wp-admin/includes/plugin-install.php @@ -155,16 +155,38 @@ function plugins_api( $action, $args = array() ) { $request = wp_remote_post( $url, $http_args ); if ( $ssl && is_wp_error( $request ) ) { - trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); + trigger_error( + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), + headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE + ); $request = wp_remote_post( $http_url, $http_args ); } if ( is_wp_error($request) ) { - $res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), $request->get_error_message() ); + $res = new WP_Error( 'plugins_api_failed', + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ), + $request->get_error_message() + ); } else { $res = maybe_unserialize( wp_remote_retrieve_body( $request ) ); - if ( ! is_object( $res ) && ! is_array( $res ) ) - $res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), wp_remote_retrieve_body( $request ) ); + if ( ! is_object( $res ) && ! is_array( $res ) ) { + $res = new WP_Error( 'plugins_api_failed', + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ), + wp_remote_retrieve_body( $request ) + ); + } } } elseif ( !is_wp_error($res) ) { $res->external = true; diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 2197368c34..822fb5b656 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -462,17 +462,39 @@ function themes_api( $action, $args = array() ) { if ( $ssl && is_wp_error( $request ) ) { if ( ! wp_doing_ajax() ) { - trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); + trigger_error( + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), + headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE + ); } $request = wp_remote_post( $http_url, $http_args ); } if ( is_wp_error($request) ) { - $res = new WP_Error('themes_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), $request->get_error_message() ); + $res = new WP_Error( 'themes_api_failed', + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ), + $request->get_error_message() + ); } else { $res = maybe_unserialize( wp_remote_retrieve_body( $request ) ); - if ( ! is_object( $res ) && ! is_array( $res ) ) - $res = new WP_Error('themes_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), wp_remote_retrieve_body( $request ) ); + if ( ! is_object( $res ) && ! is_array( $res ) ) { + $res = new WP_Error( 'themes_api_failed', + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ), + wp_remote_retrieve_body( $request ) + ); + } } } diff --git a/wp-admin/includes/translation-install.php b/wp-admin/includes/translation-install.php index ee8254d500..ed86b15cc2 100644 --- a/wp-admin/includes/translation-install.php +++ b/wp-admin/includes/translation-install.php @@ -56,17 +56,38 @@ function translations_api( $type, $args = null ) { $request = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $request ) ) { - trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); + trigger_error( + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), + headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE + ); $request = wp_remote_post( $http_url, $options ); } if ( is_wp_error( $request ) ) { - $res = new WP_Error( 'translations_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), $request->get_error_message() ); + $res = new WP_Error( 'translations_api_failed', + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ), + $request->get_error_message() + ); } else { $res = json_decode( wp_remote_retrieve_body( $request ), true ); if ( ! is_object( $res ) && ! is_array( $res ) ) { - $res = new WP_Error( 'translations_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), wp_remote_retrieve_body( $request ) ); + $res = new WP_Error( 'translations_api_failed', + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ), + wp_remote_retrieve_body( $request ) + ); } } } diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index 306745d864..e7a8b5e755 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -112,7 +112,14 @@ function get_core_checksums( $version, $locale ) { $response = wp_remote_get( $url, $options ); if ( $ssl && is_wp_error( $response ) ) { - trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); + trigger_error( + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), + headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE + ); $response = wp_remote_get( $http_url, $options ); } diff --git a/wp-admin/theme-install.php b/wp-admin/theme-install.php index 2347248d9c..dadef0dd4b 100644 --- a/wp-admin/theme-install.php +++ b/wp-admin/theme-install.php @@ -48,7 +48,11 @@ wp_localize_script( 'theme', '_wpThemeSettings', array( 'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis) 'upload' => __( 'Upload Theme' ), 'back' => __( 'Back' ), - 'error' => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + 'error' => sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ), 'themesFound' => __( 'Number of Themes found: %d' ), 'noThemesFound' => __( 'No themes found. Try a different search.' ), 'collapseSidebar' => __( 'Collapse Sidebar' ), diff --git a/wp-includes/update.php b/wp-includes/update.php index 5f074dcd14..5819872481 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -120,7 +120,14 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) { $response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $response ) ) { - trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); + trigger_error( + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), + headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE + ); $response = wp_remote_post( $http_url, $options ); } @@ -303,7 +310,14 @@ function wp_update_plugins( $extra_stats = array() ) { $raw_response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $raw_response ) ) { - trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); + trigger_error( + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), + headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE + ); $raw_response = wp_remote_post( $http_url, $options ); } @@ -476,7 +490,14 @@ function wp_update_themes( $extra_stats = array() ) { $raw_response = wp_remote_post( $url, $options ); if ( $ssl && is_wp_error( $raw_response ) ) { - trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); + trigger_error( + sprintf( + /* translators: %s: support forums URL */ + __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ), + __( 'https://wordpress.org/support/' ) + ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), + headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE + ); $raw_response = wp_remote_post( $http_url, $options ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index a466f6aa04..f8f6c53585 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta4-39324'; +$wp_version = '4.7-beta4-39325'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.