From 0488d199ac2d43bf58686c949cc24b1d750c64cc Mon Sep 17 00:00:00 2001
From: Simon Lamon <32477463+silamon@users.noreply.github.com>
Date: Wed, 6 Nov 2024 10:03:41 +0100
Subject: [PATCH] Localize automation logbook text (#22685)
* localize automation text
* localize domain
* fixup
* split up
* fixup
* prettier
---
src/components/trace/ha-trace-logbook.ts | 5 ++++-
src/components/trace/ha-trace-path-details.ts | 5 ++++-
src/components/trace/ha-trace-timeline.ts | 5 ++++-
src/components/trace/hat-logbook-note.ts | 18 +++++++++++++-----
src/translations/en.json | 4 +++-
5 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/src/components/trace/ha-trace-logbook.ts b/src/components/trace/ha-trace-logbook.ts
index b0007d2847..08158cb2bc 100644
--- a/src/components/trace/ha-trace-logbook.ts
+++ b/src/components/trace/ha-trace-logbook.ts
@@ -26,7 +26,10 @@ export class HaTraceLogbook extends LitElement {
.entries=${this.logbookEntries}
.narrow=${this.narrow}
>
-
+
`
: html`
No Logbook entries found for this step.
diff --git a/src/components/trace/ha-trace-path-details.ts b/src/components/trace/ha-trace-path-details.ts
index 2a38ca6504..410f05bd7b 100644
--- a/src/components/trace/ha-trace-path-details.ts
+++ b/src/components/trace/ha-trace-path-details.ts
@@ -291,7 +291,10 @@ export class HaTracePathDetails extends LitElement {
.entries=${entries}
.narrow=${this.narrow}
>
-
+
`
: html`
${this.hass!.localize(
diff --git a/src/components/trace/ha-trace-timeline.ts b/src/components/trace/ha-trace-timeline.ts
index 7c62b3fbb0..07e7fc3600 100644
--- a/src/components/trace/ha-trace-timeline.ts
+++ b/src/components/trace/ha-trace-timeline.ts
@@ -28,7 +28,10 @@ export class HaTraceTimeline extends LitElement {
allowPick
>
-
+
`;
}
diff --git a/src/components/trace/hat-logbook-note.ts b/src/components/trace/hat-logbook-note.ts
index 1d790a21af..bda976fe28 100644
--- a/src/components/trace/hat-logbook-note.ts
+++ b/src/components/trace/hat-logbook-note.ts
@@ -1,14 +1,22 @@
-import { css, html, LitElement } from "lit";
+import { css, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
+import type { HomeAssistant } from "../../types";
@customElement("hat-logbook-note")
class HatLogbookNote extends LitElement {
- @property() public domain = "automation";
+ @property({ attribute: false }) public hass!: HomeAssistant;
+
+ @property() public domain: "automation" | "script" = "automation";
render() {
- return html`
- Not all shown logbook entries might be related to this ${this.domain}.
- `;
+ if (this.domain === "script") {
+ return this.hass.localize(
+ "ui.panel.config.automation.trace.messages.not_all_entries_are_related_script_note"
+ );
+ }
+ return this.hass.localize(
+ "ui.panel.config.automation.trace.messages.not_all_entries_are_related_automation_note"
+ );
}
static styles = css`
diff --git a/src/translations/en.json b/src/translations/en.json
index 381a70779a..9ea5723459 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -3641,7 +3641,9 @@
"stopped_unknown_reason": "Stopped because of unknown reason {reason} at {time} (runtime: {executiontime} seconds)",
"disabled": "(disabled)",
"triggered_by": "{triggeredBy, select, \n alias {{alias} triggered}\n other {Triggered} \n} {triggeredPath, select, \n trigger {by the {trigger}}\n other {manually} \n} at {time}",
- "path_error": "Unable to extract path {path}. Download trace and report as bug."
+ "path_error": "Unable to extract path {path}. Download trace and report as bug.",
+ "not_all_entries_are_related_automation_note": "Not all shown logbook entries might be related to this automation.",
+ "not_all_entries_are_related_script_note": "Not all shown logbook entries might be related to this script."
}
}
},