mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix states not being translated in voice assistants (#93572)
Fix states not being translated
This commit is contained in:
parent
8ef799601b
commit
95e4ef2255
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user