v2.2.4 - i18n word order + auto-detect HA language
Two translation bugs fixed in this patch.
🐛 Bug Fixes
- "X ago" word order broken in non-English locales: The previous
_formatTimeAgorendered<n> <unit_ago>(e.g.1 hour ago), which only reads naturally in English. After French was added in #89, this produced1 heure il y ainstead of the correctil y a 1 heure. German (1 Stunde her->vor 1 Stunde) and Spanish (1 hora atras->hace 1 hora) had similar awkwardness. Every*_agotranslation is now a template with a{n}placeholder (e.g."il y a {n} heure","vor {n} Stunde","hace {n} hora"), and_formatTimeAgointerpolates viaString.replace("{n}", n). Locales updated: en, de, es, da, it, fr (Danish/Italian keep their natural postfix order, just with the placeholder). (#90) - Card ignored the Home Assistant user language:
setConfighardcodedlanguage: "en"as a default, so thethis.hass.languagefallback in_localizewas never reached and the card stayed in English regardless of the user's HA language preference. The default is now removed so the card auto-detects the HA language, and the visual editor's Language dropdown reflects the auto-detected language until one is explicitly selected. - Auto-detect still failed for region-tagged locales:
hass.languageis a BCP-47 tag that can include a region (e.g."de-DE","pt-BR","en_GB"), butTRANSLATIONSis keyed by base codes ("de","es", ...). The lookup missed and silently fell back to English. The detected language is now normalized to lowercase and stripped to its base code before lookup. Falls back to English only when the base locale isn't translated.