DEV: Only mark translations as htmlSafe for DButton (#30958)

If a consumer is passing in their own string to `@translatedLabel`, then
they should set it as `htmlSafe` themselves (if it is indeed safe)
This commit is contained in:
David Taylor 2025-01-23 17:59:08 +00:00 committed by GitHub
parent 097d987332
commit 2b63830496
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,7 +59,7 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView {
get computedLabel() {
if (this.args.label) {
return i18n(this.args.label);
return htmlSafe(i18n(this.args.label));
}
return this.args.translatedLabel;
}
@ -225,7 +225,7 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView {
{{~#if this.computedLabel~}}
<span class="d-button-label">
{{~htmlSafe this.computedLabel~}}
{{~this.computedLabel~}}
{{~#if @ellipsis~}}
&hellip;
{{~/if~}}