mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Replace the dependency i18n with tpl in all tags.js files (#13447)
refs: #13380 The i18n dependency is deprecated, it's being replaced by the tpl one. The `tags.js` files changed is under the following folders: - core/server/api/canary/ - core/server/api/v2/ - core/server/api/v3/
This commit is contained in:
parent
c332d4e475
commit
22546d55e8
4 changed files with 28 additions and 12 deletions
|
@ -1,10 +1,14 @@
|
||||||
const Promise = require('bluebird');
|
const Promise = require('bluebird');
|
||||||
const i18n = require('../../../shared/i18n');
|
const tpl = require('@tryghost/tpl');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
const models = require('../../models');
|
const models = require('../../models');
|
||||||
|
|
||||||
const ALLOWED_INCLUDES = ['count.posts'];
|
const ALLOWED_INCLUDES = ['count.posts'];
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
tagNotFound: 'Tag not found.'
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
docName: 'tags',
|
docName: 'tags',
|
||||||
|
|
||||||
|
@ -56,7 +60,7 @@ module.exports = {
|
||||||
.then((model) => {
|
.then((model) => {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
return Promise.reject(new errors.NotFoundError({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: i18n.t('errors.api.tags.tagNotFound')
|
message: tpl(messages.tagNotFound)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
const Promise = require('bluebird');
|
const Promise = require('bluebird');
|
||||||
const i18n = require('../../../shared/i18n');
|
const tpl = require('@tryghost/tpl');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
const models = require('../../models');
|
const models = require('../../models');
|
||||||
|
|
||||||
const ALLOWED_INCLUDES = ['count.posts'];
|
const ALLOWED_INCLUDES = ['count.posts'];
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
tagNotFound: 'Tag not found.'
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
docName: 'tags',
|
docName: 'tags',
|
||||||
|
|
||||||
|
@ -56,7 +60,7 @@ module.exports = {
|
||||||
.then((model) => {
|
.then((model) => {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
return Promise.reject(new errors.NotFoundError({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: i18n.t('errors.api.tags.tagNotFound')
|
message: tpl(messages.tagNotFound)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +112,7 @@ module.exports = {
|
||||||
.then((model) => {
|
.then((model) => {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
return Promise.reject(new errors.NotFoundError({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: i18n.t('errors.api.tags.tagNotFound')
|
message: tpl(messages.tagNotFound)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +151,7 @@ module.exports = {
|
||||||
.then(() => null)
|
.then(() => null)
|
||||||
.catch(models.Tag.NotFoundError, () => {
|
.catch(models.Tag.NotFoundError, () => {
|
||||||
return Promise.reject(new errors.NotFoundError({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: i18n.t('errors.api.tags.tagNotFound')
|
message: tpl(messages.tagNotFound)
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
const Promise = require('bluebird');
|
const Promise = require('bluebird');
|
||||||
const i18n = require('../../../shared/i18n');
|
const tpl = require('@tryghost/tpl');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
const models = require('../../models');
|
const models = require('../../models');
|
||||||
|
|
||||||
const ALLOWED_INCLUDES = ['count.posts'];
|
const ALLOWED_INCLUDES = ['count.posts'];
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
tagNotFound: 'Tag not found.'
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
docName: 'tags',
|
docName: 'tags',
|
||||||
|
|
||||||
|
@ -56,7 +60,7 @@ module.exports = {
|
||||||
.then((model) => {
|
.then((model) => {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
return Promise.reject(new errors.NotFoundError({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: i18n.t('errors.api.tags.tagNotFound')
|
message: tpl(messages.tagNotFound)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
const Promise = require('bluebird');
|
const Promise = require('bluebird');
|
||||||
const i18n = require('../../../shared/i18n');
|
const tpl = require('@tryghost/tpl');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
const models = require('../../models');
|
const models = require('../../models');
|
||||||
|
|
||||||
const ALLOWED_INCLUDES = ['count.posts'];
|
const ALLOWED_INCLUDES = ['count.posts'];
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
tagNotFound: 'Tag not found.'
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
docName: 'tags',
|
docName: 'tags',
|
||||||
|
|
||||||
|
@ -56,7 +60,7 @@ module.exports = {
|
||||||
.then((model) => {
|
.then((model) => {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
return Promise.reject(new errors.NotFoundError({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: i18n.t('errors.api.tags.tagNotFound')
|
message: tpl(messages.tagNotFound)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +112,7 @@ module.exports = {
|
||||||
.then((model) => {
|
.then((model) => {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
return Promise.reject(new errors.NotFoundError({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: i18n.t('errors.api.tags.tagNotFound')
|
message: tpl(messages.tagNotFound)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +151,7 @@ module.exports = {
|
||||||
.then(() => null)
|
.then(() => null)
|
||||||
.catch(models.Tag.NotFoundError, () => {
|
.catch(models.Tag.NotFoundError, () => {
|
||||||
return Promise.reject(new errors.NotFoundError({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: i18n.t('errors.api.tags.tagNotFound')
|
message: tpl(messages.tagNotFound)
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue