Translate timestamp-display errors + tiny tweaks (#8086)

* Translate timestamp-display errors + tiny tweaks

* Adjust translation key
This commit is contained in:
Philip Allgaier 2021-01-04 20:55:43 +01:00 committed by GitHub
parent 2c2226dfd6
commit 13b69bff1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

@ -57,7 +57,9 @@ class HuiTimestampDisplay extends LitElement {
}
if (isNaN(this.ts.getTime())) {
return html` Invalid date `;
return html`${this.hass.localize(
"ui.panel.lovelace.components.timestamp-display.invalid"
)}`;
}
const format = this._format;
@ -68,7 +70,9 @@ class HuiTimestampDisplay extends LitElement {
if (format in FORMATS) {
return html` ${FORMATS[format](this.ts, this.hass.language)} `;
}
return html` Invalid format `;
return html`${this.hass.localize(
"ui.panel.lovelace.components.timestamp-display.invalid_format"
)}`;
}
protected updated(changedProperties: PropertyValues): void {

View File

@ -71,7 +71,7 @@ const DOMAIN_TO_ELEMENT_TYPE = {
switch: "toggle",
vacuum: "toggle",
// Temporary. Once climate is rewritten,
// water heater should get it's own row.
// water heater should get its own row.
water_heater: "climate",
input_datetime: "input-datetime",
weather: "weather",

View File

@ -25,7 +25,7 @@ import { handleAction } from "../common/handle-action";
import { UNAVAILABLE_STATES } from "../../../data/entity";
interface SensorEntityConfig extends EntitiesCardEntityConfig {
format?: "relative" | "date" | "time" | "datetime";
format?: "relative" | "total" | "date" | "time" | "datetime";
}
@customElement("hui-sensor-entity-row")

View File

@ -2834,6 +2834,12 @@
"changed_toast": {
"message": "The Lovelace UI configuration for this dashboard was updated. Refresh to see changes?"
},
"components": {
"timestamp-display": {
"invalid": "Invalid timestamp",
"invalid_format": "Invalid display format"
}
},
"reload_lovelace": "Reload UI"
},
"mailbox": {