mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
refactor(translations): unify time unit translations across multiple languages
This commit is contained in:
parent
fe2cb1180a
commit
b306a491e0
6 changed files with 61 additions and 56 deletions
|
|
@ -177,7 +177,7 @@ class TibberPricesSubentryFlowHandler(ConfigSubentryFlow):
|
|||
# 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("config_subentries", {}).get("home", {}).get("time_units", {})
|
||||
time_units = translations.get("common", {}).get("time_units", {})
|
||||
|
||||
# Fallback to English if translations not available
|
||||
if not time_units:
|
||||
|
|
|
|||
|
|
@ -77,10 +77,21 @@
|
|||
}
|
||||
},
|
||||
"common": {
|
||||
"step_progress": "{step_num} / {total_steps}"
|
||||
"step_progress": "{step_num} / {total_steps}",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"config_subentries": {
|
||||
"home": {
|
||||
"entry_type": "Zeitreise-Ansicht",
|
||||
"initiate_flow": {
|
||||
"user": "Zeitreise-Ansicht erstellen"
|
||||
},
|
||||
|
|
@ -125,16 +136,6 @@
|
|||
"already_configured": "**Eine Zeitreise-Ansicht mit diesem exakten Zeitversatz existiert bereits.**\n\nBitte wähle einen anderen Versatz.",
|
||||
"no_main_entries": "Keine Hauptkonfigurationseinträge gefunden. Füge zuerst ein Tibber-Zuhause hinzu.",
|
||||
"parent_entry_not_found": "Ausgewählter Konfigurationseintrag nicht gefunden."
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -77,10 +77,21 @@
|
|||
}
|
||||
},
|
||||
"common": {
|
||||
"step_progress": "{step_num} / {total_steps}"
|
||||
"step_progress": "{step_num} / {total_steps}",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"config_subentries": {
|
||||
"home": {
|
||||
"entry_type": "Time-Travel View",
|
||||
"initiate_flow": {
|
||||
"user": "Create Time-Travel View"
|
||||
},
|
||||
|
|
@ -125,16 +136,6 @@
|
|||
"already_configured": "**A time-travel view with this exact time offset already exists.**\n\nPlease choose a different offset.",
|
||||
"no_main_entries": "No main configuration entries found. Please add a Tibber home first.",
|
||||
"parent_entry_not_found": "Selected configuration entry not found."
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -77,10 +77,21 @@
|
|||
}
|
||||
},
|
||||
"common": {
|
||||
"step_progress": "{step_num} / {total_steps}"
|
||||
"step_progress": "{step_num} / {total_steps}",
|
||||
"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å"
|
||||
}
|
||||
},
|
||||
"config_subentries": {
|
||||
"home": {
|
||||
"entry_type": "Tidsreisevisning",
|
||||
"initiate_flow": {
|
||||
"user": "Opprett tidsreisevisning"
|
||||
},
|
||||
|
|
@ -125,16 +136,6 @@
|
|||
"already_configured": "**En tidsreisevisning med denne eksakte tidsforskyvningen eksisterer allerede.**\n\nVelg en annen forskyvning.",
|
||||
"no_main_entries": "Ingen hovedkonfigurasjonsoppføringer funnet. Legg til et Tibber-hjem først.",
|
||||
"parent_entry_not_found": "Valgt konfigurasjonsoppføring ikke funnet."
|
||||
},
|
||||
"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å"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -77,10 +77,21 @@
|
|||
}
|
||||
},
|
||||
"common": {
|
||||
"step_progress": "{step_num} / {total_steps}"
|
||||
"step_progress": "{step_num} / {total_steps}",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"config_subentries": {
|
||||
"home": {
|
||||
"entry_type": "Tijdreisweergave",
|
||||
"initiate_flow": {
|
||||
"user": "Tijdreisweergave maken"
|
||||
},
|
||||
|
|
@ -125,16 +136,6 @@
|
|||
"already_configured": "**Een tijdreis-weergave met deze exacte tijdverschuiving bestaat al.**\n\nKies een andere verschuiving.",
|
||||
"no_main_entries": "Geen hoofdconfiguratie-items gevonden. Voeg eerst een Tibber-huis toe.",
|
||||
"parent_entry_not_found": "Geselecteerd configuratie-item niet gevonden."
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -77,10 +77,21 @@
|
|||
}
|
||||
},
|
||||
"common": {
|
||||
"step_progress": "{step_num} / {total_steps}"
|
||||
"step_progress": "{step_num} / {total_steps}",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"config_subentries": {
|
||||
"home": {
|
||||
"entry_type": "Tidsresevy",
|
||||
"initiate_flow": {
|
||||
"user": "Skapa tidsresevy"
|
||||
},
|
||||
|
|
@ -125,16 +136,6 @@
|
|||
"already_configured": "**En tidsresevy med denna exakta tidsförskjutning existerar redan.**\n\nVälj en annan förskjutning.",
|
||||
"no_main_entries": "Inga huvudkonfigurationsposter hittades. Lägg först till ett Tibber-hem.",
|
||||
"parent_entry_not_found": "Vald konfigurationspost hittades inte."
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue