This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/count-i18n.js.es6
Blake Erickson 2290ec9e87 DEV: Remove buffered rendering from i18n count
This is another refactoring in the multi-step process to remove all uses
of our custom Render Buffer.

Previous commit: 80f4b9e227 in this
series.

This commit affects the display of translated counts that is used in
multiple places like showing how many posts are selected using the
select posts feature on a topic. It is just a refactor and does not
change any functionality.
2019-12-04 15:39:05 -07:00

16 lines
337 B
JavaScript

import Component from "@ember/component";
export default Component.extend({
tagName: "span",
rerenderTriggers: ["count", "suffix"],
i18nCount: null,
didReceiveAttrs() {
this._super(...arguments);
this.set(
"i18nCount",
I18n.t(this.key + (this.suffix || ""), { count: this.count }).htmlSafe()
);
}
});