From 4b742adafcdc527e9b61d4fb5121699938bfa8c1 Mon Sep 17 00:00:00 2001 From: LucasOe Date: Fri, 8 Oct 2021 16:35:54 +0200 Subject: [PATCH] Replaced i18n.t w/ tpl in v2/integrations.js (#13497) refs: TryGhost#13380 - The i18n package is deprecated. It is being replaced with the tpl package. --- core/server/api/v2/integrations.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/core/server/api/v2/integrations.js b/core/server/api/v2/integrations.js index 8e79bc4621..01f11574f3 100644 --- a/core/server/api/v2/integrations.js +++ b/core/server/api/v2/integrations.js @@ -1,7 +1,11 @@ -const i18n = require('../../../shared/i18n'); +const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); +const messages = { + resourceNotFound: '{resource} not found.' +}; + module.exports = { docName: 'integrations', browse: { @@ -45,9 +49,7 @@ module.exports = { return models.Integration.findOne(data, Object.assign(options, {require: true})) .catch(models.Integration.NotFoundError, () => { throw new errors.NotFoundError({ - message: i18n.t('errors.api.resource.resourceNotFound', { - resource: 'Integration' - }) + message: tpl(messages.resourceNotFound, {resource: 'Integration'}) }); }); } @@ -78,9 +80,7 @@ module.exports = { return models.Integration.edit(data, Object.assign(options, {require: true})) .catch(models.Integration.NotFoundError, () => { throw new errors.NotFoundError({ - message: i18n.t('errors.api.resource.resourceNotFound', { - resource: 'Integration' - }) + message: tpl(messages.resourceNotFound, {resource: 'Integration'}) }); }); } @@ -136,9 +136,7 @@ module.exports = { return models.Integration.destroy(Object.assign(options, {require: true})) .catch(models.Integration.NotFoundError, () => { return Promise.reject(new errors.NotFoundError({ - message: i18n.t('errors.api.resource.resourceNotFound', { - resource: 'Integration' - }) + message: tpl(messages.resourceNotFound, {resource: 'Integration'}) })); }); }