mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-24 04:39:01 +00:00
Translate dashboard panel url error message (#27306)
* Translate dashboard panel url error message * Use backend provided translations
This commit is contained in:
@@ -309,7 +309,20 @@ export class DialogLovelaceDashboardDetail extends LitElement {
|
|||||||
}
|
}
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this._error = { base: err?.message || "Unknown error" };
|
let localizedErrorMessage: string | undefined;
|
||||||
|
if (err?.translation_domain && err?.translation_key) {
|
||||||
|
const localize = await this.hass.loadBackendTranslation(
|
||||||
|
"exceptions",
|
||||||
|
err.translation_domain
|
||||||
|
);
|
||||||
|
localizedErrorMessage = localize(
|
||||||
|
`component.${err.translation_domain}.exceptions.${err.translation_key}.message`,
|
||||||
|
err.translation_placeholders
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this._error = {
|
||||||
|
base: localizedErrorMessage || err?.message || "Unknown error",
|
||||||
|
};
|
||||||
} finally {
|
} finally {
|
||||||
this._submitting = false;
|
this._submitting = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user