mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Use trigger and condition type translation labels (#18413)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
c0ff24bf1b
commit
36f7b34ac5
@ -642,10 +642,7 @@ const tryDescribeTrigger = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Device Trigger
|
// Device Trigger
|
||||||
if (trigger.platform === "device") {
|
if (trigger.platform === "device" && trigger.device_id) {
|
||||||
if (!trigger.device_id) {
|
|
||||||
return "Device trigger";
|
|
||||||
}
|
|
||||||
const config = trigger as DeviceTrigger;
|
const config = trigger as DeviceTrigger;
|
||||||
const localized = localizeDeviceAutomationTrigger(
|
const localized = localizeDeviceAutomationTrigger(
|
||||||
hass,
|
hass,
|
||||||
@ -661,9 +658,12 @@ const tryDescribeTrigger = (
|
|||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${
|
return (
|
||||||
trigger.platform ? trigger.platform.replace(/_/g, " ") : "Unknown"
|
hass.localize(
|
||||||
} trigger`;
|
`ui.panel.config.automation.editor.triggers.type.${trigger.platform}.label`
|
||||||
|
) ||
|
||||||
|
hass.localize(`ui.panel.config.automation.editor.triggers.unknown_trigger`)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const describeCondition = (
|
export const describeCondition = (
|
||||||
@ -1074,10 +1074,7 @@ const tryDescribeCondition = (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (condition.condition === "device") {
|
if (condition.condition === "device" && condition.device_id) {
|
||||||
if (!condition.device_id) {
|
|
||||||
return "Device condition";
|
|
||||||
}
|
|
||||||
const config = condition as DeviceCondition;
|
const config = condition as DeviceCondition;
|
||||||
const localized = localizeDeviceAutomationCondition(
|
const localized = localizeDeviceAutomationCondition(
|
||||||
hass,
|
hass,
|
||||||
@ -1093,14 +1090,16 @@ const tryDescribeCondition = (
|
|||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (condition.condition === "trigger") {
|
if (condition.condition === "trigger" && condition.id) {
|
||||||
if (!condition.id) {
|
|
||||||
return "Trigger condition";
|
|
||||||
}
|
|
||||||
return `When triggered by ${condition.id}`;
|
return `When triggered by ${condition.id}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${
|
return (
|
||||||
condition.condition ? condition.condition.replace(/_/g, " ") : "Unknown"
|
hass.localize(
|
||||||
} condition`;
|
`ui.panel.config.automation.editor.conditions.type.${condition.condition}.label`
|
||||||
|
) ||
|
||||||
|
hass.localize(
|
||||||
|
`ui.panel.config.automation.editor.conditions.unknown_condition`
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
@ -2401,6 +2401,7 @@
|
|||||||
"delete_confirm_text": "It will be permanently deleted.",
|
"delete_confirm_text": "It will be permanently deleted.",
|
||||||
"unsupported_platform": "No visual editor support for platform: {platform}",
|
"unsupported_platform": "No visual editor support for platform: {platform}",
|
||||||
"type_select": "Trigger type",
|
"type_select": "Trigger type",
|
||||||
|
"unknown_trigger": "[%key:ui::panel::config::devices::automation::triggers::unknown_trigger%]",
|
||||||
"type": {
|
"type": {
|
||||||
"calendar": {
|
"calendar": {
|
||||||
"label": "Calendar",
|
"label": "Calendar",
|
||||||
@ -2596,6 +2597,7 @@
|
|||||||
"delete_confirm_text": "[%key:ui::panel::config::automation::editor::triggers::delete_confirm_text%]",
|
"delete_confirm_text": "[%key:ui::panel::config::automation::editor::triggers::delete_confirm_text%]",
|
||||||
"unsupported_condition": "No visual editor support for condition: {condition}",
|
"unsupported_condition": "No visual editor support for condition: {condition}",
|
||||||
"type_select": "Condition type",
|
"type_select": "Condition type",
|
||||||
|
"unknown_condition": "[%key:ui::panel::config::devices::automation::conditions::unknown_condition%]",
|
||||||
"type": {
|
"type": {
|
||||||
"and": {
|
"and": {
|
||||||
"label": "And",
|
"label": "And",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user