From 7cba724fdbf66dfc29d6dd2dbce47e2207c2f12c Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 2 Jun 2014 13:52:22 +1000 Subject: [PATCH] BUGFIX: some protection for missing "notification" translations --- app/assets/javascripts/discourse/models/topic_details.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/models/topic_details.js b/app/assets/javascripts/discourse/models/topic_details.js index 6a5a846146..280a1bb980 100644 --- a/app/assets/javascripts/discourse/models/topic_details.js +++ b/app/assets/javascripts/discourse/models/topic_details.js @@ -49,7 +49,11 @@ Discourse.TopicDetails = Discourse.Model.extend({ var localeString = "topic.notifications.reasons." + level; if (typeof this.get('notifications_reason_id') === 'number') { - localeString += "_" + this.get('notifications_reason_id'); + var tmp = localeString + "_" + this.get('notifications_reason_id'); + // some sane protection for missing translations of edge cases + if(I18n.lookup(tmp)){ + localeString = tmp; + } } return I18n.t(localeString, { username: Discourse.User.currentProp('username_lower') }); }.property('notification_level', 'notifications_reason_id'),