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/app/models/trust-level.js
Gerhard Schlager 41ee5b7c86
FIX: Don't store translated trust level names in anonymous cache (#13224)
Refactors `TrustLevel` and moves translations from server to client

Additional changes:
  * "staff" and "admin" wasn't translatable in site settings
  * it replaces a concatenated string with a translation
  * uses translation for trust levels in users_by_trust_level report
  * adds a DB migration to rename keys of translation overrides affected by this commit
2021-06-01 22:11:48 +02:00

23 lines
401 B
JavaScript

import { computed } from "@ember/object";
import I18n from "I18n";
export default class TrustLevel {
constructor(id, key) {
this.id = id;
this._key = key;
}
@computed
get name() {
return I18n.t(`trust_levels.names.${this._key}`);
}
@computed
get detailedName() {
return I18n.t("trust_levels.detailed_name", {
level: this.id,
name: this.name,
});
}
}