From 649461ba2f7045043a1c89102331a07838c1522e Mon Sep 17 00:00:00 2001 From: LucasOe Date: Fri, 8 Oct 2021 16:39:58 +0200 Subject: [PATCH] Replaced i18n.t w/ tpl in v2/posts.js (#13502) refs: TryGhost#13380 - The i18n package is deprecated. It is being replaced with the tpl package. --- core/server/api/v2/posts.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/server/api/v2/posts.js b/core/server/api/v2/posts.js index 99f107b694..3b20ac60ab 100644 --- a/core/server/api/v2/posts.js +++ b/core/server/api/v2/posts.js @@ -1,10 +1,14 @@ const models = require('../../models'); -const i18n = require('../../../shared/i18n'); +const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const getPostServiceInstance = require('../../services/posts/posts-service'); const allowedIncludes = ['tags', 'authors', 'authors.roles']; const unsafeAttrs = ['status', 'authors', 'visibility']; +const messages = { + postNotFound: 'Post not found.' +}; + const postsService = getPostServiceInstance('v2'); module.exports = { @@ -73,7 +77,7 @@ module.exports = { .then((model) => { if (!model) { throw new errors.NotFoundError({ - message: i18n.t('errors.api.posts.postNotFound') + message: tpl(messages.postNotFound) }); } @@ -180,7 +184,7 @@ module.exports = { .then(() => null) .catch(models.Post.NotFoundError, () => { return Promise.reject(new errors.NotFoundError({ - message: i18n.t('errors.api.posts.postNotFound') + message: tpl(messages.postNotFound) })); }); }