mirror of
https://github.com/home-assistant/core.git
synced 2025-08-12 00:55:26 +02:00
Fix states not being translated in voice assistants (#93572)
Fix states not being translated
This commit is contained in:
@@ -278,13 +278,13 @@ class DefaultAgent(AbstractConversationAgent):
|
||||
all_states = matched + unmatched
|
||||
domains = {state.domain for state in all_states}
|
||||
translations = await translation.async_get_translations(
|
||||
self.hass, language, "state", domains
|
||||
self.hass, language, "entity_component", domains
|
||||
)
|
||||
|
||||
# Use translated state names
|
||||
for state in all_states:
|
||||
device_class = state.attributes.get("device_class", "_")
|
||||
key = f"component.{state.domain}.state.{device_class}.{state.state}"
|
||||
key = f"component.{state.domain}.entity_component.{device_class}.state.{state.state}"
|
||||
state.state = translations.get(key, state.state)
|
||||
|
||||
# Get first matched or unmatched state.
|
||||
|
Reference in New Issue
Block a user