mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 10:33:51 +08:00
FIX: Translate none-tag and all-tags labels in tag filter (#9030)
* FIX: Translate none-tag and all-tags labels in tag filter * Add test
This commit is contained in:
parent
709772ea52
commit
d6a603cc50
|
@ -97,11 +97,14 @@ export default ComboBoxComponent.extend(TagsMixin, {
|
|||
const shortcuts = [];
|
||||
|
||||
if (this.tagId !== NONE_TAG_ID) {
|
||||
shortcuts.push(NO_TAG_ID);
|
||||
shortcuts.push({
|
||||
id: NO_TAG_ID,
|
||||
name: this.noTagsLabel
|
||||
});
|
||||
}
|
||||
|
||||
if (this.tagId) {
|
||||
shortcuts.push(ALL_TAGS_ID);
|
||||
shortcuts.push({ id: ALL_TAGS_ID, name: this.allTagsLabel });
|
||||
}
|
||||
|
||||
return shortcuts;
|
||||
|
@ -138,7 +141,12 @@ export default ComboBoxComponent.extend(TagsMixin, {
|
|||
|
||||
return this.searchTags("/tags/filter/search", data, this._transformJson);
|
||||
} else {
|
||||
return (this.content || []).map(tag => this.defaultItem(tag, tag));
|
||||
return (this.content || []).map(tag => {
|
||||
if (tag.id && tag.name) {
|
||||
return tag;
|
||||
}
|
||||
return this.defaultItem(tag, tag);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -75,5 +75,18 @@ componentTest("default", {
|
|||
// exists(row.el().find(".category-desc")),
|
||||
// "it shows category description for newcomers"
|
||||
// );
|
||||
|
||||
const content = this.subject.displayedContent();
|
||||
|
||||
assert.equal(
|
||||
content[0].name,
|
||||
I18n.t("tagging.selector_no_tags"),
|
||||
"it has the translated label for no-tags"
|
||||
);
|
||||
assert.equal(
|
||||
content[1].name,
|
||||
I18n.t("tagging.selector_all_tags"),
|
||||
"it has the correct label for all-tags"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user