Fix badge description i18n match.
This commit is contained in:
parent
9b26c8584e
commit
4f71256542
|
@ -48,7 +48,7 @@ Discourse.Badge = Discourse.Model.extend({
|
|||
translatedDescription: function() {
|
||||
var i18nKey = "badges." + this.get('i18nNameKey') + ".description",
|
||||
translation = I18n.t(i18nKey);
|
||||
if (translation.match(new RegExp(i18nKey))) {
|
||||
if (translation.indexOf(i18nKey) !== -1) {
|
||||
translation = null;
|
||||
}
|
||||
return translation;
|
||||
|
|
|
@ -20,7 +20,7 @@ test('translatedDescription', function() {
|
|||
var badge1 = Discourse.Badge.create({id: 1, name: "Test Badge 1"});
|
||||
equal(badge1.get('translatedDescription'), null, "returns null when no translation exists");
|
||||
|
||||
var badge2 = Discourse.Badge.create({id: 2, name: "Test Badge 2"});
|
||||
var badge2 = Discourse.Badge.create({id: 2, name: "Test Badge 2 **"});
|
||||
this.stub(I18n, "t").returns("description translation");
|
||||
equal(badge2.get('translatedDescription'), "description translation", "users translated description");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue