mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -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:
parent
3bb7813613
commit
887caa299f
1 changed files with 5 additions and 4 deletions
|
@ -1,7 +1,10 @@
|
||||||
const models = require('../../models');
|
const models = require('../../models');
|
||||||
const i18n = require('../../../shared/i18n');
|
const tpl = require('@tryghost/tpl');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
couldNotGenerateSlug: 'Could not generate slug.'
|
||||||
|
};
|
||||||
const allowedTypes = {
|
const allowedTypes = {
|
||||||
post: models.Post,
|
post: models.Post,
|
||||||
tag: models.Tag,
|
tag: models.Tag,
|
||||||
|
@ -36,9 +39,7 @@ module.exports = {
|
||||||
return models.Base.Model.generateSlug(allowedTypes[frame.options.type], frame.data.name, {status: 'all'})
|
return models.Base.Model.generateSlug(allowedTypes[frame.options.type], frame.data.name, {status: 'all'})
|
||||||
.then((slug) => {
|
.then((slug) => {
|
||||||
if (!slug) {
|
if (!slug) {
|
||||||
return Promise.reject(new errors.GhostError({
|
return Promise.reject(new errors.GhostError({message: tpl(messages.couldNotGenerateSlug)}));
|
||||||
message: i18n.t('errors.api.slugs.couldNotGenerateSlug')
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
return slug;
|
return slug;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue