Add missing translations for areas strategy (#24905)

This commit is contained in:
Paul Bottein 2025-04-03 14:02:27 +02:00 committed by GitHub
parent ca223f9d73
commit e271989cee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 19 deletions

View File

@ -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),

View File

@ -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`
<ha-expansion-panel
header=${AREA_STRATEGY_GROUP_LABELS[group]}
header=${this.hass!.localize(
`ui.panel.lovelace.strategy.areas.groups.${group}`
)}
expanded
outlined
>
@ -79,7 +80,9 @@ export class HuiAreasDashboardStrategyEditor
`
: html`
<p>
No entities in this section, it will not be displayed.
${this.hass!.localize(
"ui.panel.lovelace.editor.strategy.areas.no_entities"
)}
</p>
`}
</ha-expansion-panel>

View File

@ -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<AreaStrategyGroup, string[]>;

View File

@ -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": {