mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +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
|
||||
if (trigger.platform === "device") {
|
||||
if (!trigger.device_id) {
|
||||
return "Device trigger";
|
||||
}
|
||||
if (trigger.platform === "device" && trigger.device_id) {
|
||||
const config = trigger as DeviceTrigger;
|
||||
const localized = localizeDeviceAutomationTrigger(
|
||||
hass,
|
||||
@ -661,9 +658,12 @@ const tryDescribeTrigger = (
|
||||
}`;
|
||||
}
|
||||
|
||||
return `${
|
||||
trigger.platform ? trigger.platform.replace(/_/g, " ") : "Unknown"
|
||||
} trigger`;
|
||||
return (
|
||||
hass.localize(
|
||||
`ui.panel.config.automation.editor.triggers.type.${trigger.platform}.label`
|
||||
) ||
|
||||
hass.localize(`ui.panel.config.automation.editor.triggers.unknown_trigger`)
|
||||
);
|
||||
};
|
||||
|
||||
export const describeCondition = (
|
||||
@ -1074,10 +1074,7 @@ const tryDescribeCondition = (
|
||||
);
|
||||
}
|
||||
|
||||
if (condition.condition === "device") {
|
||||
if (!condition.device_id) {
|
||||
return "Device condition";
|
||||
}
|
||||
if (condition.condition === "device" && condition.device_id) {
|
||||
const config = condition as DeviceCondition;
|
||||
const localized = localizeDeviceAutomationCondition(
|
||||
hass,
|
||||
@ -1093,14 +1090,16 @@ const tryDescribeCondition = (
|
||||
}`;
|
||||
}
|
||||
|
||||
if (condition.condition === "trigger") {
|
||||
if (!condition.id) {
|
||||
return "Trigger condition";
|
||||
}
|
||||
if (condition.condition === "trigger" && condition.id) {
|
||||
return `When triggered by ${condition.id}`;
|
||||
}
|
||||
|
||||
return `${
|
||||
condition.condition ? condition.condition.replace(/_/g, " ") : "Unknown"
|
||||
} condition`;
|
||||
return (
|
||||
hass.localize(
|
||||
`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.",
|
||||
"unsupported_platform": "No visual editor support for platform: {platform}",
|
||||
"type_select": "Trigger type",
|
||||
"unknown_trigger": "[%key:ui::panel::config::devices::automation::triggers::unknown_trigger%]",
|
||||
"type": {
|
||||
"calendar": {
|
||||
"label": "Calendar",
|
||||
@ -2596,6 +2597,7 @@
|
||||
"delete_confirm_text": "[%key:ui::panel::config::automation::editor::triggers::delete_confirm_text%]",
|
||||
"unsupported_condition": "No visual editor support for condition: {condition}",
|
||||
"type_select": "Condition type",
|
||||
"unknown_condition": "[%key:ui::panel::config::devices::automation::conditions::unknown_condition%]",
|
||||
"type": {
|
||||
"and": {
|
||||
"label": "And",
|
||||
|
Loading…
x
Reference in New Issue
Block a user