Skip to content

Commit

Permalink
Fallback to raw config entry reason if localize returns an empty stri…
Browse files Browse the repository at this point in the history
…ng (#20668)

Show config entry reason if localize returns an empty string
  • Loading branch information
bdraco authored Apr 30, 2024
1 parent 1bc33a3 commit ec3f63e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/panels/config/integrations/ha-config-integration-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`;
}
Expand Down

0 comments on commit ec3f63e

Please sign in to comment.