0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Replaced i18n with tpl in /core/server/api/v3/slugs.js (#13524)

refs: #13380

- The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
Ayoub BERDEDDOUCH 2021-10-11 15:37:44 +02:00 committed by GitHub
parent 3bb7813613
commit 887caa299f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,10 @@
const models = require('../../models');
const i18n = require('../../../shared/i18n');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const messages = {
couldNotGenerateSlug: 'Could not generate slug.'
};
const allowedTypes = {
post: models.Post,
tag: models.Tag,
@ -36,9 +39,7 @@ module.exports = {
return models.Base.Model.generateSlug(allowedTypes[frame.options.type], frame.data.name, {status: 'all'})
.then((slug) => {
if (!slug) {
return Promise.reject(new errors.GhostError({
message: i18n.t('errors.api.slugs.couldNotGenerateSlug')
}));
return Promise.reject(new errors.GhostError({message: tpl(messages.couldNotGenerateSlug)}));
}
return slug;
});