diff --git a/lib/API/JSON/v1/Services.php b/lib/API/JSON/v1/Services.php index d1ffe91db6..695f004bcf 100644 --- a/lib/API/JSON/v1/Services.php +++ b/lib/API/JSON/v1/Services.php @@ -66,8 +66,13 @@ class Services extends APIEndpoint { break; default: $code = !empty($result['code']) ? $result['code'] : Bridge::CHECK_ERROR_UNKNOWN; + $errorMessage = __('Error validating MailPoet Sending Service key, please try again later (%s).', 'mailpoet'); + // If site runs on localhost + if( 1 === preg_match("/^(http|https)\:\/\/(localhost|127\.0\.0\.1)/", site_url()) ) { + $errorMessage .= ' ' . __("Note that it doesn't work on localhost.", 'mailpoet'); + } $error = sprintf( - __("Error validating MailPoet Sending Service key, please try again later (%s). Note that it doesn't work on localhost.", 'mailpoet'), + $errorMessage, $this->getErrorDescriptionByCode($code) ); break;