Add missing translations to statistics graph card editor (#13836)

This commit is contained in:
Erik Montnemery 2022-09-21 11:30:58 +02:00 committed by GitHub
parent cedde3d6a2
commit 977fdd9fbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -65,12 +65,6 @@ const cardConfigStruct = assign(
const periods = ["5minute", "hour", "day", "month"] as const;
const stat_types = ["mean", "min", "max", "sum"] as const;
const stat_type_labels = {
mean: "Mean",
min: "Min",
max: "Max",
sum: "Sum",
} as const;
@customElement("hui-statistics-graph-card-editor")
export class HuiStatisticsGraphCardEditor
@ -156,7 +150,9 @@ export class HuiStatisticsGraphCardEditor
multiple: true,
options: stat_types.map((stat_type) => ({
value: stat_type,
label: stat_type_labels[stat_type],
label: localize(
`ui.panel.lovelace.editor.card.statistics-graph.stat_type_labels.${stat_type}`
),
disabled:
!metaDatas ||
!metaDatas?.every((metaData) =>
@ -214,8 +210,12 @@ export class HuiStatisticsGraphCardEditor
></ha-form>
<ha-statistics-picker
.hass=${this.hass}
.pickStatisticLabel=${`Add a statistic`}
.pickedStatisticLabel=${`Statistic`}
.pickStatisticLabel=${this.hass!.localize(
"ui.panel.lovelace.editor.card.statistics-graph.pick_statistic"
)}
.pickedStatisticLabel=${this.hass!.localize(
"ui.panel.lovelace.editor.card.statistics-graph.picked_statistic"
)}
.includeDisplayUnitOfMeasurement=${displayUnit}
.ignoreRestrictionsOnFirstStatistic=${true}
.value=${this._configEntities}

View File

@ -3929,13 +3929,21 @@
"description": "The Statistics Graph card allows you to display a graph of the statistics for each of the entities listed.",
"period": "Period",
"stat_types": "Show stat types",
"stat_type_labels": {
"mean": "Mean",
"min": "Min",
"max": "Max",
"sum": "Sum"
},
"chart_type": "Chart type",
"periods": {
"hour": "Hour",
"day": "Day",
"month": "Month",
"5minute": "5 Minutes"
}
},
"pick_statistic": "Add a statistic",
"picked_statistic": "Statistic"
},
"horizontal-stack": {
"name": "Horizontal Stack",