Translate error message

[MAILPOET-929]
This commit is contained in:
Pavel Dohnal
2017-06-22 16:47:36 +01:00
parent ec3e88e658
commit 2f6fe8c804
2 changed files with 6 additions and 4 deletions

View File

@@ -1,9 +1,8 @@
function requestFailed(xhr) {
function requestFailed(errorMessage, xhr) {
if (xhr.responseJSON) {
return xhr.responseJSON;
}
var message = "An error has happened while performing a request, the server has responded with response code "
+ xhr.status;
var message = errorMessage.replace("%d", xhr.status);
return {
errors: [
{
@@ -75,7 +74,7 @@ define('ajax', ['mailpoet', 'jquery', 'underscore'], function(MailPoet, jQuery,
'json'
).then(function(data) {
return data;
}, requestFailed);
}, _.partial(requestFailed, MailPoet.I18n.t('ajaxFailedErrorMessage')));
// clear options
this.options = {};