Replaced i18n.t w/ tpl helper in email-post.js and email-preview.js (#13418)

refs: #13380

- this is to replace i18n.t with tpl because i18n.t is deprecated
- Replaced i18n.t with tpl helper in email-post.js
- Replaced i18n.t with tpl helper in email-preview.js
This commit is contained in:
Megharth Lakhataria 2021-10-04 04:57:08 -04:00 committed by GitHub
parent 4e4d092988
commit 1e73f0b07a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -1,8 +1,12 @@
const i18n = require('../../../shared/i18n');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const models = require('../../models');
const ALLOWED_INCLUDES = ['authors', 'tags'];
const messages = {
postNotFound: 'Post not found.'
};
module.exports = {
docName: 'email_post',
@ -31,7 +35,7 @@ module.exports = {
if (!model) {
throw new errors.NotFoundError({
message: i18n.t('errors.api.posts.postNotFound')
message: tpl(messages.postNotFound)
});
}

View File

@ -1,8 +1,12 @@
const models = require('../../models');
const i18n = require('../../../shared/i18n');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const mega = require('../../services/mega');
const messages = {
postNotFound: 'Post not found.'
};
const emailPreview = new mega.EmailPreview({
apiVersion: 'canary'
});
@ -33,7 +37,7 @@ module.exports = {
if (!model) {
throw new errors.NotFoundError({
message: i18n.t('errors.api.posts.postNotFound')
message: tpl(messages.postNotFound)
});
}
@ -60,7 +64,7 @@ module.exports = {
if (!model) {
throw new errors.NotFoundError({
message: i18n.t('errors.api.posts.postNotFound')
message: tpl(messages.postNotFound)
});
}