0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Replaced i18n.t w/ tpl helper in serializers/output (#13401)

* Replaced i18n.t w/ tpl helper in users

refs: #13380
The i18n package is deprecated. It is being replaced with the tpl package.

* Replaced i18n.t w/ tpl helper in authentication

refs: #13380
The i18n package is deprecated. It is being replaced with the tpl package.

Co-authored-by: Kenneth Fitzgerald <fitzgeraldkd@gmail.com>
This commit is contained in:
Kenneth Fitzgerald 2021-10-01 14:00:03 -04:00 committed by GitHub
parent e0f6d59046
commit 548e83d665
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View file

@ -1,7 +1,13 @@
const i18n = require('../../../../../../shared/i18n'); const tpl = require('@tryghost/tpl');
const mapper = require('./utils/mapper'); const mapper = require('./utils/mapper');
const debug = require('@tryghost/debug')('api:canary:utils:serializers:output:authentication'); const debug = require('@tryghost/debug')('api:canary:utils:serializers:output:authentication');
const messages = {
checkEmailForInstructions: 'Check your email for further instructions.',
passwordChanged: 'Password changed successfully.',
invitationAccepted: 'Invitation accepted.'
};
module.exports = { module.exports = {
setup(user, apiConfig, frame) { setup(user, apiConfig, frame) {
frame.response = { frame.response = {
@ -28,7 +34,7 @@ module.exports = {
generateResetToken(data, apiConfig, frame) { generateResetToken(data, apiConfig, frame) {
frame.response = { frame.response = {
passwordreset: [{ passwordreset: [{
message: i18n.t('common.api.authentication.mail.checkEmailForInstructions') message: tpl(messages.checkEmailForInstructions)
}] }]
}; };
}, },
@ -36,7 +42,7 @@ module.exports = {
resetPassword(data, apiConfig, frame) { resetPassword(data, apiConfig, frame) {
frame.response = { frame.response = {
passwordreset: [{ passwordreset: [{
message: i18n.t('common.api.authentication.mail.passwordChanged') message: tpl(messages.passwordChanged)
}] }]
}; };
}, },
@ -46,7 +52,7 @@ module.exports = {
frame.response = { frame.response = {
invitation: [ invitation: [
{message: i18n.t('common.api.authentication.mail.invitationAccepted')} {message: tpl(messages.invitationAccepted)}
] ]
}; };
}, },

View file

@ -1,7 +1,11 @@
const debug = require('@tryghost/debug')('api:canary:utils:serializers:output:users'); const debug = require('@tryghost/debug')('api:canary:utils:serializers:output:users');
const i18n = require('../../../../../../shared/i18n'); const tpl = require('@tryghost/tpl');
const mapper = require('./utils/mapper'); const mapper = require('./utils/mapper');
const messages = {
pwdChangedSuccessfully: 'Password changed successfully.'
};
module.exports = { module.exports = {
browse(models, apiConfig, frame) { browse(models, apiConfig, frame) {
debug('browse'); debug('browse');
@ -39,7 +43,7 @@ module.exports = {
debug('changePassword'); debug('changePassword');
frame.response = { frame.response = {
password: [{message: i18n.t('notices.api.users.pwdChangedSuccessfully')}] password: [{message: tpl(messages.pwdChangedSuccessfully)}]
}; };
}, },