mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Replaced i18n.t w/ tpl helper in providers.js
refs: TryGhost#13380 The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
parent
189b7bb97b
commit
9ca2e205a1
1 changed files with 8 additions and 3 deletions
|
@ -2,7 +2,12 @@ const _ = require('lodash');
|
||||||
const Promise = require('bluebird');
|
const Promise = require('bluebird');
|
||||||
const models = require('../../models');
|
const models = require('../../models');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
const i18n = require('../../../shared/i18n');
|
const tpl = require('@tryghost/tpl');
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
userNotFound: 'User not found',
|
||||||
|
apiKeyNotFound: 'API Key not found'
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
user: function (id) {
|
user: function (id) {
|
||||||
|
@ -11,7 +16,7 @@ module.exports = {
|
||||||
// CASE: {context: {user: id}} where the id is not in our database
|
// CASE: {context: {user: id}} where the id is not in our database
|
||||||
if (!foundUser) {
|
if (!foundUser) {
|
||||||
return Promise.reject(new errors.NotFoundError({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: i18n.t('errors.models.user.userNotFound')
|
message: tpl(messages.userNotFound)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +61,7 @@ module.exports = {
|
||||||
.then((foundApiKey) => {
|
.then((foundApiKey) => {
|
||||||
if (!foundApiKey) {
|
if (!foundApiKey) {
|
||||||
throw new errors.NotFoundError({
|
throw new errors.NotFoundError({
|
||||||
message: i18n.t('errors.models.api_key.apiKeyNotFound')
|
message: tpl(messages.apiKeyNotFound)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue