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