mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
Replace i18n with tpl in api/v3/pages.js (#13585)
refs: #13380 - The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
parent
6e14047a2a
commit
f8033596c0
@ -1,9 +1,12 @@
|
||||
const models = require('../../models');
|
||||
const i18n = require('../../../shared/i18n');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
const getPostServiceInstance = require('../../services/posts/posts-service');
|
||||
const ALLOWED_INCLUDES = ['tags', 'authors', 'authors.roles'];
|
||||
const UNSAFE_ATTRS = ['status', 'authors', 'visibility'];
|
||||
const messages = {
|
||||
pageNotFound: 'Page not found'
|
||||
};
|
||||
|
||||
const postsService = getPostServiceInstance('v3');
|
||||
|
||||
@ -75,7 +78,7 @@ module.exports = {
|
||||
.then((model) => {
|
||||
if (!model) {
|
||||
throw new errors.NotFoundError({
|
||||
message: i18n.t('errors.api.pages.pageNotFound')
|
||||
message: tpl(messages.pageNotFound)
|
||||
});
|
||||
}
|
||||
|
||||
@ -188,7 +191,7 @@ module.exports = {
|
||||
.then(() => null)
|
||||
.catch(models.Post.NotFoundError, () => {
|
||||
return Promise.reject(new errors.NotFoundError({
|
||||
message: i18n.t('errors.api.pages.pageNotFound')
|
||||
message: tpl(messages.pageNotFound)
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user