mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 02:19:31 +00:00
Add state_translated function to jinja templates (#96906)
* Add state_translated jinja function * Add tests for load_state_translations_to_cache and get_cached_translations * Cleanup state_translated template * Add tests for state_translated jinja function * Apply black formatting * Improve code quality * Apply suggestions from code review Co-authored-by: Erik Montnemery <erik@montnemery.com> * Apply suggestions from code review * Prevent invalid components from loading translations * Refactor loading translations to cache * Adjust code issues * Update homeassistant/helpers/translation.py Co-authored-by: Erik Montnemery <erik@montnemery.com> * Refactor listeners that trigger translation loading * Apply suggestions from code review Co-authored-by: Erik Montnemery <erik@montnemery.com> * Apply suggestions from code review * Adjust invalid function calls, fix code styling * Adjust code quality * Extract async_translate_state function * Apply suggestions from code review Co-authored-by: Erik Montnemery <erik@montnemery.com> * Apply suggestions from code review * Fix tests * Fix tests --------- Co-authored-by: Piotr Machowski <PiotrMachowski@users.noreply.github.com> Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
@@ -35,6 +35,7 @@ from .helpers import (
|
||||
recorder,
|
||||
restore_state,
|
||||
template,
|
||||
translation,
|
||||
)
|
||||
from .helpers.dispatcher import async_dispatcher_send
|
||||
from .helpers.typing import ConfigType
|
||||
@@ -291,6 +292,7 @@ async def async_load_base_functionality(hass: core.HomeAssistant) -> None:
|
||||
platform.uname().processor # pylint: disable=expression-not-assigned
|
||||
|
||||
# Load the registries and cache the result of platform.uname().processor
|
||||
translation.async_setup(hass)
|
||||
entity.async_setup(hass)
|
||||
template.async_setup(hass)
|
||||
await asyncio.gather(
|
||||
|
||||
Reference in New Issue
Block a user