From ec3f63e8a3cddf3f91db37717e59265a0cb5a539 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 30 Apr 2024 05:25:45 -0500 Subject: [PATCH] Fallback to raw config entry reason if localize returns an empty string (#20668) Show config entry reason if localize returns an empty string --- .../integrations/ha-config-integration-page.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index 746d625a74..7eabbeb93e 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -557,18 +557,22 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { if (item.error_reason_translation_key) { const lokalisePromExc = this.hass .loadBackendTranslation("exceptions", item.domain) - .then((localize) => - localize( - `component.${item.domain}.exceptions.${item.error_reason_translation_key}.message`, - item.error_reason_translation_placeholders ?? undefined - ) + .then( + (localize) => + localize( + `component.${item.domain}.exceptions.${item.error_reason_translation_key}.message`, + item.error_reason_translation_placeholders ?? undefined + ) || item.reason ); stateTextExtra = html`${until(lokalisePromExc)}`; } else { const lokalisePromError = this.hass .loadBackendTranslation("config", item.domain) - .then((localize) => - localize(`component.${item.domain}.config.error.${item.reason}`) + .then( + (localize) => + localize( + `component.${item.domain}.config.error.${item.reason}` + ) || item.reason ); stateTextExtra = html`${until(lokalisePromError, item.reason)}`; }