mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
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:
parent
0cbc813f28
commit
b2e4145bd9
1 changed files with 10 additions and 4 deletions
|
@ -1,8 +1,14 @@
|
||||||
const Promise = require('bluebird');
|
const Promise = require('bluebird');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const i18n = require('../../../../../../shared/i18n');
|
const tpl = require('@tryghost/tpl');
|
||||||
const {BadRequestError, ValidationError} = require('@tryghost/errors');
|
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 = {
|
module.exports = {
|
||||||
edit(apiConfig, frame) {
|
edit(apiConfig, frame) {
|
||||||
const errors = [];
|
const errors = [];
|
||||||
|
@ -12,8 +18,8 @@ module.exports = {
|
||||||
// @NOTE: active theme has to be changed via theme endpoints
|
// @NOTE: active theme has to be changed via theme endpoints
|
||||||
errors.push(
|
errors.push(
|
||||||
new BadRequestError({
|
new BadRequestError({
|
||||||
message: i18n.t('errors.api.settings.activeThemeSetViaAPI.error'),
|
message: tpl(messages.error),
|
||||||
help: i18n.t('errors.api.settings.activeThemeSetViaAPI.help')
|
help: tpl(messages.help)
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +31,7 @@ module.exports = {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
errors.push(
|
errors.push(
|
||||||
new ValidationError({
|
new ValidationError({
|
||||||
message: i18n.t('notices.data.validation.index.schemaValidationFailed', {
|
message: tpl(messages.schemaValidationFailed, {
|
||||||
key: 'unsplash'
|
key: 'unsplash'
|
||||||
}),
|
}),
|
||||||
property: 'unsplash'
|
property: 'unsplash'
|
||||||
|
|
Loading…
Add table
Reference in a new issue