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.
This commit is contained in:
IncredibleZuess 2021-10-13 09:53:57 +02:00 committed by GitHub
parent 0cbc813f28
commit b2e4145bd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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'