mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 12:16:39 +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")
|
||||
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() {
|
||||
super(
|
||||
|
@ -33,16 +33,24 @@ export abstract class HaDeviceAutomationPicker<
|
||||
|
||||
@property() public value?: T;
|
||||
|
||||
protected NO_AUTOMATION_TEXT = "No automations";
|
||||
|
||||
protected UNKNOWN_AUTOMATION_TEXT = "Unknown automation";
|
||||
|
||||
@internalProperty() private _automations: T[] = [];
|
||||
|
||||
// Trigger an empty render so we start with a clean DOM.
|
||||
// paper-listbox does not like changing things around.
|
||||
@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: (
|
||||
hass: HomeAssistant,
|
||||
automation: T
|
||||
|
@ -11,9 +11,17 @@ import { HaDeviceAutomationPicker } from "./ha-device-automation-picker";
|
||||
class HaDeviceConditionPicker extends HaDeviceAutomationPicker<
|
||||
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() {
|
||||
super(
|
||||
|
@ -9,9 +9,17 @@ import { HaDeviceAutomationPicker } from "./ha-device-automation-picker";
|
||||
|
||||
@customElement("ha-device-trigger-picker")
|
||||
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() {
|
||||
super(
|
||||
|
@ -1604,15 +1604,22 @@
|
||||
"automation": {
|
||||
"automations": "Automations",
|
||||
"no_automations": "No automations",
|
||||
"unknown_automation": "Unknown automation",
|
||||
"create": "Create automation with device",
|
||||
"triggers": {
|
||||
"caption": "Do something when..."
|
||||
"caption": "Do something when...",
|
||||
"no_triggers": "No triggers",
|
||||
"unknown_trigger": "Unknown trigger"
|
||||
},
|
||||
"conditions": {
|
||||
"caption": "Only do something if..."
|
||||
"caption": "Only do something if...",
|
||||
"no_conditions": "No conditions",
|
||||
"unknown_condition": "Unknown condition"
|
||||
},
|
||||
"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."
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user