From e271989cee202ee23738b495d8366ffbabaf430e Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 3 Apr 2025 14:02:27 +0200 Subject: [PATCH] Add missing translations for areas strategy (#24905) --- .../lovelace/strategies/areas/area-view-strategy.ts | 13 +++++++------ .../editor/hui-areas-dashboard-strategy-editor.ts | 9 ++++++--- .../areas/helpers/areas-strategy-helper.ts | 9 --------- src/translations/en.json | 12 +++++++++++- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/panels/lovelace/strategies/areas/area-view-strategy.ts b/src/panels/lovelace/strategies/areas/area-view-strategy.ts index b9c9025091..853568dfbb 100644 --- a/src/panels/lovelace/strategies/areas/area-view-strategy.ts +++ b/src/panels/lovelace/strategies/areas/area-view-strategy.ts @@ -8,7 +8,6 @@ import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; import type { HomeAssistant } from "../../../../types"; import { AREA_STRATEGY_GROUP_ICONS, - AREA_STRATEGY_GROUP_LABELS, computeAreaTileCardConfig, getAreaGroupedEntities, } from "./helpers/areas-strategy-helper"; @@ -85,7 +84,7 @@ export class AreaViewStrategy extends ReactiveElement { type: "grid", cards: [ computeHeadingCard( - AREA_STRATEGY_GROUP_LABELS.lights, + hass.localize("ui.panel.lovelace.strategy.areas.groups.lights"), AREA_STRATEGY_GROUP_ICONS.lights ), ...lights.map(computeTileCard), @@ -98,7 +97,7 @@ export class AreaViewStrategy extends ReactiveElement { type: "grid", cards: [ computeHeadingCard( - AREA_STRATEGY_GROUP_LABELS.climate, + hass.localize("ui.panel.lovelace.strategy.areas.groups.climate"), AREA_STRATEGY_GROUP_ICONS.climate ), ...climate.map(computeTileCard), @@ -111,7 +110,9 @@ export class AreaViewStrategy extends ReactiveElement { type: "grid", cards: [ computeHeadingCard( - AREA_STRATEGY_GROUP_LABELS.media_players, + hass.localize( + "ui.panel.lovelace.strategy.areas.groups.media_players" + ), AREA_STRATEGY_GROUP_ICONS.media_players ), ...media_players.map(computeTileCard), @@ -124,7 +125,7 @@ export class AreaViewStrategy extends ReactiveElement { type: "grid", cards: [ computeHeadingCard( - AREA_STRATEGY_GROUP_LABELS.security, + hass.localize("ui.panel.lovelace.strategy.areas.groups.security"), AREA_STRATEGY_GROUP_ICONS.security ), ...security.map(computeTileCard), @@ -137,7 +138,7 @@ export class AreaViewStrategy extends ReactiveElement { type: "grid", cards: [ computeHeadingCard( - AREA_STRATEGY_GROUP_LABELS.others, + hass.localize("ui.panel.lovelace.strategy.areas.groups.others"), AREA_STRATEGY_GROUP_ICONS.others ), ...others.map(computeTileCard), diff --git a/src/panels/lovelace/strategies/areas/editor/hui-areas-dashboard-strategy-editor.ts b/src/panels/lovelace/strategies/areas/editor/hui-areas-dashboard-strategy-editor.ts index a3add6bfe8..10975e4d35 100644 --- a/src/panels/lovelace/strategies/areas/editor/hui-areas-dashboard-strategy-editor.ts +++ b/src/panels/lovelace/strategies/areas/editor/hui-areas-dashboard-strategy-editor.ts @@ -12,7 +12,6 @@ import type { AreaStrategyGroup } from "../helpers/areas-strategy-helper"; import { AREA_STRATEGY_GROUP_ICONS, AREA_STRATEGY_GROUPS, - AREA_STRATEGY_GROUP_LABELS, getAreaGroupedEntities, } from "../helpers/areas-strategy-helper"; import type { LovelaceStrategyEditor } from "../../types"; @@ -57,7 +56,9 @@ export class HuiAreasDashboardStrategyEditor return html` @@ -79,7 +80,9 @@ export class HuiAreasDashboardStrategyEditor ` : html`

- No entities in this section, it will not be displayed. + ${this.hass!.localize( + "ui.panel.lovelace.editor.strategy.areas.no_entities" + )}

`}
diff --git a/src/panels/lovelace/strategies/areas/helpers/areas-strategy-helper.ts b/src/panels/lovelace/strategies/areas/helpers/areas-strategy-helper.ts index 64934c6216..2c284fcca8 100644 --- a/src/panels/lovelace/strategies/areas/helpers/areas-strategy-helper.ts +++ b/src/panels/lovelace/strategies/areas/helpers/areas-strategy-helper.ts @@ -32,15 +32,6 @@ export const AREA_STRATEGY_GROUP_ICONS = { others: "mdi:shape", }; -// Todo be replace by translation when validated -export const AREA_STRATEGY_GROUP_LABELS = { - lights: "Lights", - climate: "Climate", - media_players: "Entertainment", - security: "Security", - others: "Others", -}; - export type AreaStrategyGroup = (typeof AREA_STRATEGY_GROUPS)[number]; type AreaEntitiesByGroup = Record; diff --git a/src/translations/en.json b/src/translations/en.json index 3cb9843bff..0f0ccbf264 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -6328,6 +6328,15 @@ "strategy": { "original-states": { "helpers": "[%key:ui::panel::config::helpers::caption%]" + }, + "areas": { + "groups": { + "lights": "Lights", + "climate": "Climate", + "media_players": "Entertainment", + "security": "Security", + "others": "Others" + } } }, "cards": { @@ -7531,7 +7540,8 @@ "url": "URL" }, "areas": { - "areas_display": "Areas to display" + "areas_display": "Areas to display", + "no_entities": "No entities in this group, the section will not be displayed" } }, "view": {