From d9f48dcbb00efa774959fb3cfc8685d2c5bbffe6 Mon Sep 17 00:00:00 2001 From: Mateus Etto Date: Mon, 17 Apr 2017 01:39:05 -0300 Subject: [PATCH] Fixed text of check-in prize when it is a set of backgrounds (#8599) * Fixed text of check-in prize when it is a set of backgrounds * Use existing i18n string for BGs name * Added user.preferences.language as second parameter --- website/common/script/content/loginIncentives.js | 1 + website/server/libs/cron.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/website/common/script/content/loginIncentives.js b/website/common/script/content/loginIncentives.js index 24e6a9cebd..39783702eb 100644 --- a/website/common/script/content/loginIncentives.js +++ b/website/common/script/content/loginIncentives.js @@ -15,6 +15,7 @@ module.exports = function getLoginIncentives (api) { 2: { rewardKey: ['background_purple'], reward: [api.backgrounds.incentiveBackgrounds], + rewardName: 'incentiveBackgrounds', // i18n string assignReward: function assignReward (user) { user.purchased.background.blue = true; user.purchased.background.green = true; diff --git a/website/server/libs/cron.js b/website/server/libs/cron.js index 36f3d3f2e1..ec7f5915d7 100644 --- a/website/server/libs/cron.js +++ b/website/server/libs/cron.js @@ -157,7 +157,7 @@ function awardLoginIncentives (user) { notificationData.rewardText = i18n.t('potion', {potionType: notificationData.rewardText}, user.preferences.language); } } else if (loginIncentive.rewardKey[0] === 'background_blue') { - notificationData.rewardText = i18n.t('incentiveBackgrounds'); + notificationData.rewardText = i18n.t('incentiveBackgrounds', user.preferences.language); } if (loginIncentive.reward.length > 0 && count < loginIncentive.reward.length - 1) notificationData.rewardText += ', '; @@ -165,6 +165,11 @@ function awardLoginIncentives (user) { count += 1; } + // Overwrite notificationData.rewardText if rewardName was explicitly declared + if (loginIncentive.rewardName) { + notificationData.rewardText = i18n.t(loginIncentive.rewardName, user.preferences.language); + } + notificationData.rewardKey = loginIncentive.rewardKey; notificationData.message = i18n.t('unlockedCheckInReward', user.preferences.language); }