From 0a69c7a08dd98a9db930a98adf57ff0b5f424ad1 Mon Sep 17 00:00:00 2001 From: Alys Date: Tue, 19 Sep 2017 21:44:45 +1000 Subject: [PATCH] allow customised text and translations for notifications for gaining/losing gold/xp/mana/health (#9049) --- .../client/components/snackbars/notification.vue | 13 +++++++------ website/common/locales/en/character.json | 8 ++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/website/client/components/snackbars/notification.vue b/website/client/components/snackbars/notification.vue index a32b6b045d..891eccd0d9 100644 --- a/website/client/components/snackbars/notification.vue +++ b/website/client/components/snackbars/notification.vue @@ -141,12 +141,13 @@ export default { }, computed: { message () { - let direction = this.negative === 'negative' ? 'lost' : 'gained'; - - if (this.notification.type === 'hp') return `You ${direction} some ${this.$t('health')}`; - if (this.notification.type === 'mp') return `You ${direction} some ${this.$t('mana')}`; - if (this.notification.type === 'xp') return `You ${direction} some exp`; - if (this.notification.type === 'gp') return `You ${direction} some ${this.$t('gold')}`; + let localeKey = this.negative === 'negative' ? 'lost' : 'gained'; + if (this.notification.type === 'hp') localeKey += 'Health'; + if (this.notification.type === 'mp') localeKey += 'Mana'; + if (this.notification.type === 'xp') localeKey += 'Experience'; + if (this.notification.type === 'gp') localeKey += 'Gold'; + return this.$t(localeKey); + // This requires eight translatable strings, but that gives the translators the most flexibility for matching gender/number and for using idioms for lost/spent/used/gained. }, negative () { return this.notification.sign === '-' ? 'negative' : 'positive'; diff --git a/website/common/locales/en/character.json b/website/common/locales/en/character.json index 89a9b0cec1..9760b7834d 100644 --- a/website/common/locales/en/character.json +++ b/website/common/locales/en/character.json @@ -166,6 +166,14 @@ "youCastTarget": "You cast <%= spell %> on <%= target %>.", "youCastParty": "You cast <%= spell %> for the party.", "critBonus": "Critical Hit! Bonus: ", + "gainedGold": "You gained some Gold", + "gainedMana": "You gained some Mana", + "gainedHealth": "You gained some Health", + "gainedExperience": "You gained some Experience", + "lostGold": "You spent some Gold", + "lostMana": "You used some Mana", + "lostHealth": "You lost some Health", + "lostExperience": "You lost some Experience", "displayNameDescription1": "This is what appears in messages you post in the Tavern, guilds, and party chat, along with what is displayed on your avatar. To change it, click the Edit button above. If instead you want to change your login name, go to", "displayNameDescription2": "Settings->Site", "displayNameDescription3": "and look in the Registration section.",