182 files

This commit is contained in:
Home Assistant Version Control
2026-08-17 12:11:35 +00:00
parent 7dddf6bb13
commit ece15a1c1b
183 changed files with 11457 additions and 3092 deletions
@@ -79,6 +79,17 @@ export function t(key: string, lang?: string): string {
return STORE[l]?.[key] ?? STORE.en[key] ?? key;
}
/**
* The UI language for a hass object — the ONE rule every component's `_lang`
* getter delegates to. Before this helper the 23 hand-copied getters had
* drifted into three variants (`|| "en"`, `?? navigator.language...`, and a
* `locale.language` probe), so sibling components could resolve different
* languages from the same hass.
*/
export function langOf(hass?: { language?: string }): string {
return hass?.language || "en";
}
/** True when *lang*'s table is in memory (English is always bundled). */
export function isLocaleLoaded(lang?: string): boolean {
const l = normLang(lang);