From b2e4145bd97924d19f43dcf303ca2b7ab3a2e86e Mon Sep 17 00:00:00 2001 From: IncredibleZuess <57303461+IncredibleZuess@users.noreply.github.com> Date: Wed, 13 Oct 2021 09:53:57 +0200 Subject: [PATCH] Replaced i18n.t w/ tpl in api/v2/utils/validators/input/settings.js (#13578) refs: TryGhost#13380 - The i18n package is deprecated. It is being replaced with the tpl package. --- .../api/v2/utils/validators/input/settings.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/server/api/v2/utils/validators/input/settings.js b/core/server/api/v2/utils/validators/input/settings.js index c639f95587..3240200282 100644 --- a/core/server/api/v2/utils/validators/input/settings.js +++ b/core/server/api/v2/utils/validators/input/settings.js @@ -1,8 +1,14 @@ const Promise = require('bluebird'); const _ = require('lodash'); -const i18n = require('../../../../../../shared/i18n'); +const tpl = require('@tryghost/tpl'); const {BadRequestError, ValidationError} = require('@tryghost/errors'); +const messages = { + error: 'Attempted to change active_theme via settings API', + help: 'Please activate theme via the themes API endpoints instead', + schemaValidationFailed: 'Validation failed for \'{key}\'.' +}; + module.exports = { edit(apiConfig, frame) { const errors = []; @@ -12,8 +18,8 @@ module.exports = { // @NOTE: active theme has to be changed via theme endpoints errors.push( new BadRequestError({ - message: i18n.t('errors.api.settings.activeThemeSetViaAPI.error'), - help: i18n.t('errors.api.settings.activeThemeSetViaAPI.help') + message: tpl(messages.error), + help: tpl(messages.help) }) ); } @@ -25,7 +31,7 @@ module.exports = { } catch (e) { errors.push( new ValidationError({ - message: i18n.t('notices.data.validation.index.schemaValidationFailed', { + message: tpl(messages.schemaValidationFailed, { key: 'unsplash' }), property: 'unsplash'