Replaced i18n.t w/ tpl in v3/settings.js (#13551)

refs: TryGhost#13380

- The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
Indrakant Dana 2021-10-12 13:06:11 +05:30 committed by GitHub
parent c1789a3a03
commit 8029d1ce6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,11 +2,16 @@ const Promise = require('bluebird');
const _ = require('lodash');
const models = require('../../models');
const routeSettings = require('../../services/route-settings');
const i18n = require('../../../shared/i18n');
const tpl = require('@tryghost/tpl');
const {BadRequestError, NoPermissionError} = require('@tryghost/errors');
const settingsService = require('../../services/settings');
const membersService = require('../../services/members');
const messages = {
error: 'Failed to send email.',
accessCoreSettingFromExtReq: 'Attempted to access core setting from external request'
};
const settingsBREADService = settingsService.getSettingsBREADServiceInstance();
module.exports = {
@ -109,7 +114,7 @@ module.exports = {
} catch (err) {
throw new BadRequestError({
err,
message: i18n.t('errors.mail.failedSendingEmail.error')
message: tpl(messages.error)
});
}
}
@ -162,7 +167,7 @@ module.exports = {
const firstCoreSetting = frame.data.settings.find(setting => setting.group === 'core');
if (firstCoreSetting) {
throw new NoPermissionError({
message: i18n.t('errors.api.settings.accessCoreSettingFromExtReq')
message: tpl(messages.accessCoreSettingFromExtReq)
});
}
}