Fix translations to be injected at config time
This commit is contained in:
@ -83,7 +83,7 @@ define([
|
|||||||
that.get('_container').get('blocks').reset(content, {parse: true});
|
that.get('_container').get('blocks').reset(content, {parse: true});
|
||||||
that.trigger('postsChanged');
|
that.trigger('postsChanged');
|
||||||
}).fail(function(error) {
|
}).fail(function(error) {
|
||||||
MailPoet.Notice(MailPoetI18n.failedToFetchRenderedPosts);
|
MailPoet.Notice.error(App.getConfig().get('translations.failedToFetchRenderedPosts'));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +79,7 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
||||||
mailpoet_custom_fields_window_title: MailPoetI18n.customFieldsWindowTitle,
|
mailpoet_custom_fields_window_title: App.getConfig().get('translations.customFieldsWindowTitle'),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -79,7 +79,7 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
||||||
mailpoet_custom_fields_window_title: MailPoetI18n.customFieldsWindowTitle,
|
mailpoet_custom_fields_window_title: App.getConfig().get('translations.customFieldsWindowTitle'),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -101,7 +101,7 @@ define([
|
|||||||
that.get('_selectedPosts').reset(); // Empty out the collection
|
that.get('_selectedPosts').reset(); // Empty out the collection
|
||||||
that.trigger('change:_availablePosts');
|
that.trigger('change:_availablePosts');
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
MailPoet.Notice(MailPoetI18n.failedToFetchAvailablePosts);
|
MailPoet.Notice.error(App.getConfig().get('translations.failedToFetchAvailablePosts'));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_refreshTransformedPosts: function() {
|
_refreshTransformedPosts: function() {
|
||||||
@ -118,7 +118,7 @@ define([
|
|||||||
CommunicationComponent.getTransformedPosts(data).done(function(posts) {
|
CommunicationComponent.getTransformedPosts(data).done(function(posts) {
|
||||||
that.get('_transformedPosts').get('blocks').reset(posts, {parse: true});
|
that.get('_transformedPosts').get('blocks').reset(posts, {parse: true});
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
MailPoet.Notice(MailPoetI18n.failedToFetchRenderedPosts);
|
MailPoet.Notice.error(App.getConfig().get('translations.failedToFetchRenderedPosts'));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_insertSelectedPosts: function() {
|
_insertSelectedPosts: function() {
|
||||||
@ -134,7 +134,7 @@ define([
|
|||||||
CommunicationComponent.getTransformedPosts(data).done(function(posts) {
|
CommunicationComponent.getTransformedPosts(data).done(function(posts) {
|
||||||
collection.add(posts, { at: index });
|
collection.add(posts, { at: index });
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
MailPoet.Notice(MailPoetI18n.failedToFetchRenderedPosts);
|
MailPoet.Notice.error(App.getConfig().get('translations.failedToFetchRenderedPosts'));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -77,7 +77,7 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
||||||
mailpoet_custom_fields_window_title: MailPoetI18n.customFieldsWindowTitle,
|
mailpoet_custom_fields_window_title: App.getConfig().get('translations.customFieldsWindowTitle'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -191,7 +191,7 @@ define([
|
|||||||
|
|
||||||
if (templateName === '') {
|
if (templateName === '') {
|
||||||
MailPoet.Notice.error(
|
MailPoet.Notice.error(
|
||||||
MailPoetI18n.templateNameMissing,
|
App.getConfig().get('translations.templateNameMissing'),
|
||||||
{
|
{
|
||||||
positionAfter: that.$el,
|
positionAfter: that.$el,
|
||||||
scroll: true,
|
scroll: true,
|
||||||
@ -199,7 +199,7 @@ define([
|
|||||||
);
|
);
|
||||||
} else if (templateDescription === '') {
|
} else if (templateDescription === '') {
|
||||||
MailPoet.Notice.error(
|
MailPoet.Notice.error(
|
||||||
MailPoetI18n.templateDescriptionMissing,
|
App.getConfig().get('translations.templateDescriptionMissing'),
|
||||||
{
|
{
|
||||||
positionAfter: that.$el,
|
positionAfter: that.$el,
|
||||||
scroll: true,
|
scroll: true,
|
||||||
@ -211,7 +211,7 @@ define([
|
|||||||
description: templateDescription,
|
description: templateDescription,
|
||||||
}).done(function() {
|
}).done(function() {
|
||||||
MailPoet.Notice.success(
|
MailPoet.Notice.success(
|
||||||
MailPoetI18n.templateSaved,
|
App.getConfig().get('translations.templateSaved'),
|
||||||
{
|
{
|
||||||
positionAfter: that.$el,
|
positionAfter: that.$el,
|
||||||
scroll: true,
|
scroll: true,
|
||||||
@ -219,7 +219,7 @@ define([
|
|||||||
);
|
);
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
MailPoet.Notice.error(
|
MailPoet.Notice.error(
|
||||||
MailPoetI18n.templateSaveFailed,
|
App.getConfig().get('translations.templateSaveFailed'),
|
||||||
{
|
{
|
||||||
positionAfter: that.$el,
|
positionAfter: that.$el,
|
||||||
scroll: true,
|
scroll: true,
|
||||||
@ -244,7 +244,7 @@ define([
|
|||||||
|
|
||||||
if (templateName === '') {
|
if (templateName === '') {
|
||||||
MailPoet.Notice.error(
|
MailPoet.Notice.error(
|
||||||
MailPoetI18n.templateNameMissing,
|
App.getConfig().get('translations.templateNameMissing'),
|
||||||
{
|
{
|
||||||
positionAfter: that.$el,
|
positionAfter: that.$el,
|
||||||
scroll: true,
|
scroll: true,
|
||||||
@ -252,7 +252,7 @@ define([
|
|||||||
);
|
);
|
||||||
} else if (templateDescription === '') {
|
} else if (templateDescription === '') {
|
||||||
MailPoet.Notice.error(
|
MailPoet.Notice.error(
|
||||||
MailPoetI18n.templateDescriptionMissing,
|
App.getConfig().get('translations.templateDescriptionMissing'),
|
||||||
{
|
{
|
||||||
positionAfter: that.$el,
|
positionAfter: that.$el,
|
||||||
scroll: true,
|
scroll: true,
|
||||||
@ -285,7 +285,7 @@ define([
|
|||||||
|
|
||||||
if (App.getConfig().get('validation.validateUnsubscribeLinkPresent') &&
|
if (App.getConfig().get('validation.validateUnsubscribeLinkPresent') &&
|
||||||
JSON.stringify(jsonObject).indexOf("[unsubscribeUrl]") < 0) {
|
JSON.stringify(jsonObject).indexOf("[unsubscribeUrl]") < 0) {
|
||||||
this.showValidationError(MailPoetI18n.unsubscribeLinkMissing);
|
this.showValidationError(App.getConfig().get('translations.unsubscribeLinkMissing'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,24 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/components/communication',
|
'newsletter_editor/components/communication',
|
||||||
|
'mailpoet',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'backbone.supermodel',
|
'backbone.supermodel',
|
||||||
'underscore',
|
'underscore',
|
||||||
'jquery',
|
'jquery',
|
||||||
'sticky-kit'
|
'sticky-kit'
|
||||||
], function(App, CommunicationComponent, Backbone, Marionette, SuperModel, _, jQuery, StickyKit) {
|
], function(
|
||||||
|
App,
|
||||||
|
CommunicationComponent,
|
||||||
|
MailPoet,
|
||||||
|
Backbone,
|
||||||
|
Marionette,
|
||||||
|
SuperModel,
|
||||||
|
_,
|
||||||
|
jQuery,
|
||||||
|
StickyKit
|
||||||
|
) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -254,7 +265,7 @@ define([
|
|||||||
|
|
||||||
if (data.subscriber.length <= 0) {
|
if (data.subscriber.length <= 0) {
|
||||||
MailPoet.Notice.error(
|
MailPoet.Notice.error(
|
||||||
MailPoetI18n.newsletterPreviewEmailMissing,
|
App.getConfig().get('translations.newsletterPreviewEmailMissing'),
|
||||||
{
|
{
|
||||||
positionAfter: $emailField,
|
positionAfter: $emailField,
|
||||||
scroll: true,
|
scroll: true,
|
||||||
@ -268,7 +279,7 @@ define([
|
|||||||
|
|
||||||
CommunicationComponent.previewNewsletter(data).done(function(response) {
|
CommunicationComponent.previewNewsletter(data).done(function(response) {
|
||||||
if(response.result !== undefined && response.result === true) {
|
if(response.result !== undefined && response.result === true) {
|
||||||
MailPoet.Notice.success(MailPoetI18n.newsletterPreviewSent, { scroll: true });
|
MailPoet.Notice.success(App.getConfig().get('translations.newsletterPreviewSent'), { scroll: true });
|
||||||
} else {
|
} else {
|
||||||
if (_.isArray(response.errors)) {
|
if (_.isArray(response.errors)) {
|
||||||
response.errors.map(function(error) {
|
response.errors.map(function(error) {
|
||||||
@ -276,7 +287,7 @@ define([
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
MailPoet.Notice.error(
|
MailPoet.Notice.error(
|
||||||
MailPoetI18n.newsletterPreviewFailedToSend,
|
App.getConfig().get('translations.newsletterPreviewFailedToSend'),
|
||||||
{
|
{
|
||||||
scroll: true,
|
scroll: true,
|
||||||
static: true,
|
static: true,
|
||||||
|
@ -1256,6 +1256,7 @@
|
|||||||
validation: {
|
validation: {
|
||||||
validateUnsubscribeLinkPresent: true, // TODO: Add validation based on whether Mailpoet MTA is used or not
|
validateUnsubscribeLinkPresent: true, // TODO: Add validation based on whether Mailpoet MTA is used or not
|
||||||
},
|
},
|
||||||
|
translations: MailPoetI18n,
|
||||||
urls: {
|
urls: {
|
||||||
send: '<%= admin_url('admin.php?page=mailpoet-newsletters#/send/' ~ params('id')) %>',
|
send: '<%= admin_url('admin.php?page=mailpoet-newsletters#/send/' ~ params('id')) %>',
|
||||||
imageMissing: '<%= image_url(
|
imageMissing: '<%= image_url(
|
||||||
|
Reference in New Issue
Block a user