mirror of
https://github.com/DigiLive/mushroom-strategy.git
synced 2025-08-04 20:14:28 +02:00
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:
@@ -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 ?? {});
|
||||||
|
@@ -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) {
|
||||||
|
Reference in New Issue
Block a user