Skip to content

Commit

Permalink
Load translations on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
jbouwh committed Nov 1, 2023
1 parent 2366db9 commit 43c2c5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/layouts/home-assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
// @ts-ignore
this._loadHassTranslations(this.hass!.language, "state");

// @ts-ignore
this._loadHassTranslations(this.hass!.language, "exceptions");

document.addEventListener(
"visibilitychange",
() => this._checkVisibility(),
Expand Down
6 changes: 5 additions & 1 deletion src/state/connection-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
}
if (notifyOnError) {
forwardHaptic("failure");
const localizedErrorMessage = (this as any).hass.localize(
const lokalize = await (this as any).loadBackendTranslation(
"exceptions",
domain
);
const localizedErrorMessage = lokalize(
`component.${err.translation_domain}.exceptions.${err.translation_key}.message`,
err.translation_placeholders
);
Expand Down

0 comments on commit 43c2c5e

Please sign in to comment.