mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Add translation support for script errors (#18786)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
93158bb3af
commit
3876c67588
@ -423,7 +423,20 @@ class HaPanelDevService extends LitElement {
|
|||||||
}
|
}
|
||||||
forwardHaptic("failure");
|
forwardHaptic("failure");
|
||||||
button.actionError();
|
button.actionError();
|
||||||
|
|
||||||
|
let localizedErrorMessage: string | undefined;
|
||||||
|
if (err.translation_domain && err.translation_key) {
|
||||||
|
const lokalize = await this.hass.loadBackendTranslation(
|
||||||
|
"exceptions",
|
||||||
|
err.translation_domain
|
||||||
|
);
|
||||||
|
localizedErrorMessage = lokalize(
|
||||||
|
`component.${err.translation_domain}.exceptions.${err.translation_key}.message`,
|
||||||
|
err.translation_placeholders
|
||||||
|
);
|
||||||
|
}
|
||||||
this._error =
|
this._error =
|
||||||
|
localizedErrorMessage ||
|
||||||
this.hass.localize("ui.notification_toast.service_call_failed", {
|
this.hass.localize("ui.notification_toast.service_call_failed", {
|
||||||
service: this._serviceData!.service!,
|
service: this._serviceData!.service!,
|
||||||
}) + ` ${err.message}`;
|
}) + ` ${err.message}`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user