From 1e73f0b07a9c6fd0b5bcce090d2cf4ad78d47c94 Mon Sep 17 00:00:00 2001 From: Megharth Lakhataria Date: Mon, 4 Oct 2021 04:57:08 -0400 Subject: [PATCH] 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 --- core/server/api/canary/email-post.js | 8 ++++++-- core/server/api/canary/email-preview.js | 10 +++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/server/api/canary/email-post.js b/core/server/api/canary/email-post.js index da971498e9..20dc3c21f5 100644 --- a/core/server/api/canary/email-post.js +++ b/core/server/api/canary/email-post.js @@ -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) }); } diff --git a/core/server/api/canary/email-preview.js b/core/server/api/canary/email-preview.js index dfb6d71d59..8a7acb1a98 100644 --- a/core/server/api/canary/email-preview.js +++ b/core/server/api/canary/email-preview.js @@ -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) }); }