Ensure push notification description reacts to language change (#7856)

This commit is contained in:
Philip Allgaier 2020-12-02 12:11:47 +01:00 committed by GitHub
parent 25f7cbea5a
commit daaf2b1796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ class HaPushNotificationsRow extends LocalizeMixin(PolymerElement) {
>[[localize('ui.panel.profile.push_notifications.header')]]</span
>
<span slot="description">
[[_description(_platformLoaded, _pushSupported)]]
[[localize(_descrLocalizeKey)]]
<a
href="[[_computeDocumentationUrl(hass)]]"
target="_blank"
@ -45,6 +45,10 @@ class HaPushNotificationsRow extends LocalizeMixin(PolymerElement) {
return {
hass: Object,
narrow: Boolean,
_descrLocalizeKey: {
type: String,
computed: "_descriptionKey(_platformLoaded, _pushSupported)",
},
_platformLoaded: {
type: Boolean,
computed: "_compPlatformLoaded(hass)",
@ -72,7 +76,7 @@ class HaPushNotificationsRow extends LocalizeMixin(PolymerElement) {
return !platformLoaded || !pushSupported_;
}
_description(platformLoaded, pushSupported_) {
_descriptionKey(platformLoaded, pushSupported_) {
let key;
if (!pushSupported_) {
key = "error_use_https";
@ -81,7 +85,7 @@ class HaPushNotificationsRow extends LocalizeMixin(PolymerElement) {
} else {
key = "description";
}
return this.localize(`ui.panel.profile.push_notifications.${key}`);
return `ui.panel.profile.push_notifications.${key}`;
}
}