Localize trigger condition and add list formatting (#18488)

This commit is contained in:
karwosts 2023-11-01 07:42:43 -07:00 committed by GitHub
parent 5f2375fe84
commit cfa522068c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -1090,8 +1090,16 @@ const tryDescribeCondition = (
}`; }`;
} }
if (condition.condition === "trigger" && condition.id) { if (condition.condition === "trigger" && condition.id != null) {
return `When triggered by ${condition.id}`; return hass.localize(
`${conditionsTranslationBaseKey}.trigger.description.full`,
{
id: formatListWithOrs(
hass.locale,
ensureArray(condition.id).map((id) => id.toString())
),
}
);
} }
return ( return (

View File

@ -2689,7 +2689,10 @@
"trigger": { "trigger": {
"label": "Triggered by", "label": "Triggered by",
"no_triggers": "No triggers have an ID set. You can set an ID using the trigger menu button.", "no_triggers": "No triggers have an ID set. You can set an ID using the trigger menu button.",
"id": "Trigger" "id": "Trigger",
"description": {
"full": "When triggered by {id}"
}
}, },
"zone": { "zone": {
"label": "[%key:ui::panel::config::automation::editor::triggers::type::zone::label%]", "label": "[%key:ui::panel::config::automation::editor::triggers::type::zone::label%]",