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:
parent
3bb7813613
commit
887caa299f
1 changed files with 5 additions and 4 deletions
|
@ -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;
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue