Fix localization of ConfigurationDefaults

The defaults where imported before localization was set up.
The import is now moved to after this required setup.
This commit is contained in:
DigiLive
2025-04-27 09:52:26 +02:00
parent 984f597ab8
commit 2c9159c25e
2 changed files with 1 additions and 2 deletions

View File

@@ -1,6 +1,5 @@
import deepmerge from 'deepmerge'; import deepmerge from 'deepmerge';
import { HassEntities } from 'home-assistant-js-websocket'; import { HassEntities } from 'home-assistant-js-websocket';
import { ConfigurationDefaults } from './configurationDefaults';
import { AreaRegistryEntry } from './types/homeassistant/data/area_registry'; import { AreaRegistryEntry } from './types/homeassistant/data/area_registry';
import { DeviceRegistryEntry } from './types/homeassistant/data/device_registry'; import { DeviceRegistryEntry } from './types/homeassistant/data/device_registry';
import { EntityRegistryEntry } from './types/homeassistant/data/entity_registry'; import { EntityRegistryEntry } from './types/homeassistant/data/entity_registry';
@@ -112,6 +111,7 @@ class Registry {
// Import the Hass States and strategy options. // Import the Hass States and strategy options.
Registry._hassStates = info.hass.states; Registry._hassStates = info.hass.states;
const { ConfigurationDefaults } = await import('./configurationDefaults');
try { try {
Registry._strategyOptions = deepmerge(ConfigurationDefaults, info.config?.strategy?.options ?? {}); Registry._strategyOptions = deepmerge(ConfigurationDefaults, info.config?.strategy?.options ?? {});

View File

@@ -62,7 +62,6 @@ export default function setupCustomLocalize(hass?: HomeAssistant): void {
/** /**
* Translate a key using the globally configured localize function. * Translate a key using the globally configured localize function.
* Throws if not initialized.
*/ */
export function localize(key: string): string { export function localize(key: string): string {
if (!_localize) { if (!_localize) {