Replaced i18n.t w/ tpl in version-match middleware

refs: TryGhost#13380

- The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
Ozan Uslan 2021-10-04 14:19:48 +03:00 committed by Hannah Wolfe
parent b1395bbe20
commit d1b7055af5

View File

@ -1,6 +1,10 @@
const semver = require('semver');
const errors = require('@tryghost/errors');
const i18n = require('../../../../shared/i18n');
const tpl = require('@tryghost/tpl');
const messages = {
versionMismatch: 'Client request for {clientVersion} does not match server version {serverVersion}.'
};
function checkVersionMatch(req, res, next) {
const clientVersion = req.get('X-Ghost-Version');
@ -14,7 +18,7 @@ function checkVersionMatch(req, res, next) {
if (clientVersion && !semver.satisfies(serverVersion, constraint)) {
return next(new errors.VersionMismatchError({
message: i18n.t('errors.middleware.api.versionMismatch', {
message: tpl(messages.versionMismatch, {
clientVersion: clientVersion,
serverVersion: serverVersion
})