mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-30 20:56:36 +00:00
Make error texts of device automation picker translatable (#7370)
This commit is contained in:
parent
b67575586e
commit
105b7678b8
@ -9,9 +9,17 @@ import { HaDeviceAutomationPicker } from "./ha-device-automation-picker";
|
|||||||
|
|
||||||
@customElement("ha-device-action-picker")
|
@customElement("ha-device-action-picker")
|
||||||
class HaDeviceActionPicker extends HaDeviceAutomationPicker<DeviceAction> {
|
class HaDeviceActionPicker extends HaDeviceAutomationPicker<DeviceAction> {
|
||||||
protected NO_AUTOMATION_TEXT = "No actions";
|
protected get NO_AUTOMATION_TEXT() {
|
||||||
|
return this.hass.localize(
|
||||||
|
"ui.panel.config.devices.automation.actions.no_actions"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
protected UNKNOWN_AUTOMATION_TEXT = "Unknown action";
|
protected get UNKNOWN_AUTOMATION_TEXT() {
|
||||||
|
return this.hass.localize(
|
||||||
|
"ui.panel.config.devices.automation.actions.unknown_action"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
super(
|
||||||
|
@ -33,16 +33,24 @@ export abstract class HaDeviceAutomationPicker<
|
|||||||
|
|
||||||
@property() public value?: T;
|
@property() public value?: T;
|
||||||
|
|
||||||
protected NO_AUTOMATION_TEXT = "No automations";
|
|
||||||
|
|
||||||
protected UNKNOWN_AUTOMATION_TEXT = "Unknown automation";
|
|
||||||
|
|
||||||
@internalProperty() private _automations: T[] = [];
|
@internalProperty() private _automations: T[] = [];
|
||||||
|
|
||||||
// Trigger an empty render so we start with a clean DOM.
|
// Trigger an empty render so we start with a clean DOM.
|
||||||
// paper-listbox does not like changing things around.
|
// paper-listbox does not like changing things around.
|
||||||
@internalProperty() private _renderEmpty = false;
|
@internalProperty() private _renderEmpty = false;
|
||||||
|
|
||||||
|
protected get NO_AUTOMATION_TEXT() {
|
||||||
|
return this.hass.localize(
|
||||||
|
"ui.panel.config.devices.automation.actions.no_actions"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected get UNKNOWN_AUTOMATION_TEXT() {
|
||||||
|
return this.hass.localize(
|
||||||
|
"ui.panel.config.devices.automation.actions.unknown_action"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private _localizeDeviceAutomation: (
|
private _localizeDeviceAutomation: (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
automation: T
|
automation: T
|
||||||
|
@ -11,9 +11,17 @@ import { HaDeviceAutomationPicker } from "./ha-device-automation-picker";
|
|||||||
class HaDeviceConditionPicker extends HaDeviceAutomationPicker<
|
class HaDeviceConditionPicker extends HaDeviceAutomationPicker<
|
||||||
DeviceCondition
|
DeviceCondition
|
||||||
> {
|
> {
|
||||||
protected NO_AUTOMATION_TEXT = "No conditions";
|
protected get NO_AUTOMATION_TEXT() {
|
||||||
|
return this.hass.localize(
|
||||||
|
"ui.panel.config.devices.automation.conditions.no_conditions"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
protected UNKNOWN_AUTOMATION_TEXT = "Unknown condition";
|
protected get UNKNOWN_AUTOMATION_TEXT() {
|
||||||
|
return this.hass.localize(
|
||||||
|
"ui.panel.config.devices.automation.conditions.unknown_condition"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
super(
|
||||||
|
@ -9,9 +9,17 @@ import { HaDeviceAutomationPicker } from "./ha-device-automation-picker";
|
|||||||
|
|
||||||
@customElement("ha-device-trigger-picker")
|
@customElement("ha-device-trigger-picker")
|
||||||
class HaDeviceTriggerPicker extends HaDeviceAutomationPicker<DeviceTrigger> {
|
class HaDeviceTriggerPicker extends HaDeviceAutomationPicker<DeviceTrigger> {
|
||||||
protected NO_AUTOMATION_TEXT = "No triggers";
|
protected get NO_AUTOMATION_TEXT() {
|
||||||
|
return this.hass.localize(
|
||||||
|
"ui.panel.config.devices.automation.triggers.no_triggers"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
protected UNKNOWN_AUTOMATION_TEXT = "Unknown trigger";
|
protected get UNKNOWN_AUTOMATION_TEXT() {
|
||||||
|
return this.hass.localize(
|
||||||
|
"ui.panel.config.devices.automation.triggers.unknown_trigger"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
super(
|
||||||
|
@ -1604,15 +1604,22 @@
|
|||||||
"automation": {
|
"automation": {
|
||||||
"automations": "Automations",
|
"automations": "Automations",
|
||||||
"no_automations": "No automations",
|
"no_automations": "No automations",
|
||||||
|
"unknown_automation": "Unknown automation",
|
||||||
"create": "Create automation with device",
|
"create": "Create automation with device",
|
||||||
"triggers": {
|
"triggers": {
|
||||||
"caption": "Do something when..."
|
"caption": "Do something when...",
|
||||||
|
"no_triggers": "No triggers",
|
||||||
|
"unknown_trigger": "Unknown trigger"
|
||||||
},
|
},
|
||||||
"conditions": {
|
"conditions": {
|
||||||
"caption": "Only do something if..."
|
"caption": "Only do something if...",
|
||||||
|
"no_conditions": "No conditions",
|
||||||
|
"unknown_condition": "Unknown condition"
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"caption": "When something is triggered..."
|
"caption": "When something is triggered...",
|
||||||
|
"no_actions": "No actions",
|
||||||
|
"unknown_action": "Unknown action"
|
||||||
},
|
},
|
||||||
"no_device_automations": "There are no automations available for this device."
|
"no_device_automations": "There are no automations available for this device."
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user