mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-17 14:26:35 +00:00
Fix automation translations + gallery (#17166)
This commit is contained in:
parent
44aca9688d
commit
8bd09edec0
@ -162,6 +162,7 @@ export class DemoAutomationDescribeAction extends LitElement {
|
|||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
const hass = provideHass(this);
|
const hass = provideHass(this);
|
||||||
hass.updateTranslations(null, "en");
|
hass.updateTranslations(null, "en");
|
||||||
|
hass.updateTranslations("config", "en");
|
||||||
hass.addEntities(ENTITIES);
|
hass.addEntities(ENTITIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ export class DemoAutomationDescribeCondition extends LitElement {
|
|||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
const hass = provideHass(this);
|
const hass = provideHass(this);
|
||||||
hass.updateTranslations(null, "en");
|
hass.updateTranslations(null, "en");
|
||||||
|
hass.updateTranslations("config", "en");
|
||||||
hass.addEntities(ENTITIES);
|
hass.addEntities(ENTITIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ const triggers = [
|
|||||||
},
|
},
|
||||||
{ platform: "sun", event: "sunset" },
|
{ platform: "sun", event: "sunset" },
|
||||||
{ platform: "time_pattern" },
|
{ platform: "time_pattern" },
|
||||||
|
{ platform: "time_pattern", hours: "*", minutes: "/5", seconds: "10" },
|
||||||
{ platform: "webhook" },
|
{ platform: "webhook" },
|
||||||
{ platform: "persistent_notification" },
|
{ platform: "persistent_notification" },
|
||||||
{
|
{
|
||||||
@ -105,6 +106,7 @@ export class DemoAutomationDescribeTrigger extends LitElement {
|
|||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
const hass = provideHass(this);
|
const hass = provideHass(this);
|
||||||
hass.updateTranslations(null, "en");
|
hass.updateTranslations(null, "en");
|
||||||
|
hass.updateTranslations("config", "en");
|
||||||
hass.addEntities(ENTITIES);
|
hass.addEntities(ENTITIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,12 +397,10 @@ const tryDescribeTrigger = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Time Pattern Trigger
|
// Time Pattern Trigger
|
||||||
if (
|
if (trigger.platform === "time_pattern") {
|
||||||
trigger.platform === "time_pattern" &&
|
if (!trigger.seconds && !trigger.minutes && !trigger.hours) {
|
||||||
(trigger.seconds !== undefined ||
|
return "When a time pattern matches";
|
||||||
trigger.minutes !== undefined ||
|
}
|
||||||
trigger.hours !== undefined)
|
|
||||||
) {
|
|
||||||
let result = "Trigger ";
|
let result = "Trigger ";
|
||||||
if (trigger.seconds !== undefined) {
|
if (trigger.seconds !== undefined) {
|
||||||
const seconds_all = trigger.seconds === "*";
|
const seconds_all = trigger.seconds === "*";
|
||||||
|
@ -189,7 +189,7 @@ const tryDescribeAction = <T extends ActionType>(
|
|||||||
duration = hass.localize(
|
duration = hass.localize(
|
||||||
`${actionTranslationBaseKey}.delay.description.duration_string`,
|
`${actionTranslationBaseKey}.delay.description.duration_string`,
|
||||||
{
|
{
|
||||||
duration: secondsToDuration(config.delay)!,
|
string: secondsToDuration(config.delay)!,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else if (typeof config.delay === "string") {
|
} else if (typeof config.delay === "string") {
|
||||||
@ -200,7 +200,7 @@ const tryDescribeAction = <T extends ActionType>(
|
|||||||
: hass.localize(
|
: hass.localize(
|
||||||
`${actionTranslationBaseKey}.delay.description.duration_string`,
|
`${actionTranslationBaseKey}.delay.description.duration_string`,
|
||||||
{
|
{
|
||||||
duration:
|
string:
|
||||||
config.delay ||
|
config.delay ||
|
||||||
hass.localize(
|
hass.localize(
|
||||||
`${actionTranslationBaseKey}.delay.description.duration_unknown`
|
`${actionTranslationBaseKey}.delay.description.duration_unknown`
|
||||||
@ -211,14 +211,14 @@ const tryDescribeAction = <T extends ActionType>(
|
|||||||
duration = hass.localize(
|
duration = hass.localize(
|
||||||
`${actionTranslationBaseKey}.delay.description.duration_string`,
|
`${actionTranslationBaseKey}.delay.description.duration_string`,
|
||||||
{
|
{
|
||||||
duration: formatDuration(config.delay),
|
string: formatDuration(config.delay),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
duration = hass.localize(
|
duration = hass.localize(
|
||||||
`${actionTranslationBaseKey}.delay.description.duration_string`,
|
`${actionTranslationBaseKey}.delay.description.duration_string`,
|
||||||
{
|
{
|
||||||
duration: hass.localize(
|
string: hass.localize(
|
||||||
`${actionTranslationBaseKey}.delay.description.duration_unknown`
|
`${actionTranslationBaseKey}.delay.description.duration_unknown`
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user