Merge pull request #421 from floatinghotpot/patch-6

i18n-ize meteor email templates
This commit is contained in:
Maxime Quandalle 2015-12-03 19:34:15 -08:00
commit d4c5310d65
3 changed files with 23 additions and 0 deletions

View file

@ -51,4 +51,11 @@ if (Meteor.isServer) {
if (process.env.MAIL_FROM) {
Accounts.emailTemplates.from = process.env.MAIL_FROM;
}
['resetPassword-subject', 'resetPassword-text', 'verifyEmail-subject', 'verifyEmail-text', 'enrollAccount-subject', 'enrollAccount-text'].forEach((str) => {
const words = str.split('-');
Accounts.emailTemplates[words[0]][words[1]] = (user, url) => {
return TAPi18n.__(`email-${str}`, { user: user.getName(), url }, user.getLanguage());
};
});
}

View file

@ -124,6 +124,12 @@
"editLabelPopup-title": "Change Label",
"editProfilePopup-title": "Edit Profile",
"email": "Email",
"email-enrollAccount-subject": "An account created for you on __url__",
"email-enrollAccount-text": "Hello __user__,\n\nTo start using the service, simply click the link below.\n\n__url__\n\nThanks.\n",
"email-resetPassword-subject": "Reset your password on __url__",
"email-resetPassword-text": "Hello __user__,\n\nTo reset your password, simply click the link below.\n\n__url__\n\nThanks.\n",
"email-verifyEmail-subject": "Verify your email address on __url__",
"email-verifyEmail-text": "Hello __user__,\n\nTo verify your account email, simply click the link below.\n\n__url__\n\nThanks.\n",
"error-board-notAMember": "You need to be a member of this board to do that",
"error-json-malformed": "Your text is not valid JSON",
"error-json-schema": "Your JSON data does not include the proper information in the correct format",

View file

@ -68,6 +68,16 @@ Users.helpers({
return this.username[0].toUpperCase();
}
},
getName() {
const profile = this.profile || {};
return profile.fullname || this.username;
},
getLanguage() {
const profile = this.profile || {};
return profile.language || 'en';
},
});
Users.mutations({