Fix hassfest validation: Move time_units from translations to custom_translations

Co-authored-by: jpawlowski <75446+jpawlowski@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-01 02:09:26 +00:00
parent 9b1d24abc9
commit 529f134556
6 changed files with 54 additions and 4 deletions

View file

@ -174,10 +174,10 @@ class TibberPricesSubentryFlowHandler(ConfigSubentryFlow):
-7, -2, -30 -> "7 days - 02:30" (compact format when time is added) -7, -2, -30 -> "7 days - 02:30" (compact format when time is added)
""" """
# Get translations loaded by Home Assistant # Get translations from custom_translations (loaded via async_load_translations)
standard_translations_key = f"{DOMAIN}_standard_translations_{self.hass.config.language}" translations_key = f"{DOMAIN}_translations_{self.hass.config.language}"
translations = self.hass.data.get(standard_translations_key, {}) translations = self.hass.data.get(translations_key, {})
time_units = translations.get("common", {}).get("time_units", {}) time_units = translations.get("time_units", {})
# Fallback to English if translations not available # Fallback to English if translations not available
if not time_units: if not time_units:

View file

@ -477,5 +477,15 @@
"HOUSE": "Haus", "HOUSE": "Haus",
"COTTAGE": "Ferienhaus" "COTTAGE": "Ferienhaus"
}, },
"time_units": {
"day": "{count} Tag",
"days": "{count} Tagen",
"hour": "{count} Stunde",
"hours": "{count} Stunden",
"minute": "{count} Minute",
"minutes": "{count} Minuten",
"ago": "vor {parts}",
"now": "jetzt"
},
"attribution": "Daten bereitgestellt von Tibber" "attribution": "Daten bereitgestellt von Tibber"
} }

View file

@ -477,5 +477,15 @@
"HOUSE": "House", "HOUSE": "House",
"COTTAGE": "Cottage" "COTTAGE": "Cottage"
}, },
"time_units": {
"day": "{count} day",
"days": "{count} days",
"hour": "{count} hour",
"hours": "{count} hours",
"minute": "{count} minute",
"minutes": "{count} minutes",
"ago": "{parts} ago",
"now": "now"
},
"attribution": "Data provided by Tibber" "attribution": "Data provided by Tibber"
} }

View file

@ -482,5 +482,15 @@
"HOUSE": "Hus", "HOUSE": "Hus",
"COTTAGE": "Hytte" "COTTAGE": "Hytte"
}, },
"time_units": {
"day": "{count} dag",
"days": "{count} dager",
"hour": "{count} time",
"hours": "{count} timer",
"minute": "{count} minutt",
"minutes": "{count} minutter",
"ago": "{parts} siden",
"now": "nå"
},
"attribution": "Data levert av Tibber" "attribution": "Data levert av Tibber"
} }

View file

@ -482,5 +482,15 @@
"HOUSE": "Huis", "HOUSE": "Huis",
"COTTAGE": "Huisje" "COTTAGE": "Huisje"
}, },
"time_units": {
"day": "{count} dag",
"days": "{count} dagen",
"hour": "{count} uur",
"hours": "{count} uur",
"minute": "{count} minuut",
"minutes": "{count} minuten",
"ago": "{parts} geleden",
"now": "nu"
},
"attribution": "Gegevens geleverd door Tibber" "attribution": "Gegevens geleverd door Tibber"
} }

View file

@ -482,5 +482,15 @@
"HOUSE": "Hus", "HOUSE": "Hus",
"COTTAGE": "Stuga" "COTTAGE": "Stuga"
}, },
"time_units": {
"day": "{count} dag",
"days": "{count} dagar",
"hour": "{count} timme",
"hours": "{count} timmar",
"minute": "{count} minut",
"minutes": "{count} minuter",
"ago": "{parts} sedan",
"now": "nu"
},
"attribution": "Data tillhandahålls av Tibber" "attribution": "Data tillhandahålls av Tibber"
} }