From 529f13455674015d10d849d65da0e0658d75b3bd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 02:09:26 +0000 Subject: [PATCH] Fix hassfest validation: Move time_units from translations to custom_translations Co-authored-by: jpawlowski <75446+jpawlowski@users.noreply.github.com> --- .../config_flow_handlers/subentry_flow.py | 8 ++++---- .../tibber_prices/custom_translations/de.json | 10 ++++++++++ .../tibber_prices/custom_translations/en.json | 10 ++++++++++ .../tibber_prices/custom_translations/nb.json | 10 ++++++++++ .../tibber_prices/custom_translations/nl.json | 10 ++++++++++ .../tibber_prices/custom_translations/sv.json | 10 ++++++++++ 6 files changed, 54 insertions(+), 4 deletions(-) diff --git a/custom_components/tibber_prices/config_flow_handlers/subentry_flow.py b/custom_components/tibber_prices/config_flow_handlers/subentry_flow.py index 7560fb1..6f813c7 100644 --- a/custom_components/tibber_prices/config_flow_handlers/subentry_flow.py +++ b/custom_components/tibber_prices/config_flow_handlers/subentry_flow.py @@ -174,10 +174,10 @@ class TibberPricesSubentryFlowHandler(ConfigSubentryFlow): -7, -2, -30 -> "7 days - 02:30" (compact format when time is added) """ - # Get translations loaded by Home Assistant - standard_translations_key = f"{DOMAIN}_standard_translations_{self.hass.config.language}" - translations = self.hass.data.get(standard_translations_key, {}) - time_units = translations.get("common", {}).get("time_units", {}) + # Get translations from custom_translations (loaded via async_load_translations) + translations_key = f"{DOMAIN}_translations_{self.hass.config.language}" + translations = self.hass.data.get(translations_key, {}) + time_units = translations.get("time_units", {}) # Fallback to English if translations not available if not time_units: diff --git a/custom_components/tibber_prices/custom_translations/de.json b/custom_components/tibber_prices/custom_translations/de.json index 07d01af..885741b 100644 --- a/custom_components/tibber_prices/custom_translations/de.json +++ b/custom_components/tibber_prices/custom_translations/de.json @@ -477,5 +477,15 @@ "HOUSE": "Haus", "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" } diff --git a/custom_components/tibber_prices/custom_translations/en.json b/custom_components/tibber_prices/custom_translations/en.json index 94a9997..3c145c0 100644 --- a/custom_components/tibber_prices/custom_translations/en.json +++ b/custom_components/tibber_prices/custom_translations/en.json @@ -477,5 +477,15 @@ "HOUSE": "House", "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" } diff --git a/custom_components/tibber_prices/custom_translations/nb.json b/custom_components/tibber_prices/custom_translations/nb.json index 6e58e74..812ddf7 100644 --- a/custom_components/tibber_prices/custom_translations/nb.json +++ b/custom_components/tibber_prices/custom_translations/nb.json @@ -482,5 +482,15 @@ "HOUSE": "Hus", "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" } diff --git a/custom_components/tibber_prices/custom_translations/nl.json b/custom_components/tibber_prices/custom_translations/nl.json index 9ef7eea..430808f 100644 --- a/custom_components/tibber_prices/custom_translations/nl.json +++ b/custom_components/tibber_prices/custom_translations/nl.json @@ -482,5 +482,15 @@ "HOUSE": "Huis", "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" } diff --git a/custom_components/tibber_prices/custom_translations/sv.json b/custom_components/tibber_prices/custom_translations/sv.json index 31a1944..950c7c0 100644 --- a/custom_components/tibber_prices/custom_translations/sv.json +++ b/custom_components/tibber_prices/custom_translations/sv.json @@ -482,5 +482,15 @@ "HOUSE": "Hus", "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" }