Refactored i18n out of custom redirects middleware

refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings

- i18n is an old pattern we are getting rid of
This commit is contained in:
Naz 2021-09-28 15:28:06 +02:00
parent 3965e8051b
commit dc051eb21a

View File

@ -5,11 +5,14 @@ const debug = require('@tryghost/debug')('web:shared:mw:custom-redirects');
const config = require('../../../../shared/config');
const urlUtils = require('../../../../shared/url-utils');
const errors = require('@tryghost/errors');
const i18n = require('../../../../shared/i18n');
const logging = require('@tryghost/logging');
const redirectsService = require('../../../services/redirects');
const labsService = require('../../../../shared/labs');
const messages = {
customRedirectsRegistrationFailure: 'Could not register custom redirects.'
};
const _private = {};
let customRedirectsRouter;
@ -90,7 +93,7 @@ _private.registerRoutes = () => {
logging.error(err);
} else {
logging.error(new errors.IncorrectUsageError({
message: i18n.t('errors.middleware.redirects.register'),
message: messages.customRedirectsRegistrationFailure,
context: err.message,
help: 'https://ghost.org/docs/themes/routing/#redirects',
err