Allow fetching translations by categories (#34329)
This commit is contained in:
1 parent
d1b3ed717e
commit
98f1548f2d
6 files changed
+140
-51
No files matched your search
@@ -536,7 +536,13 @@ def websocket_get_themes(hass, connection, msg):
|
||||
|
||||
|
||||
@websocket_api.websocket_command(
|
||||
{"type": "frontend/get_translations", vol.Required("language"): str}
|
||||
{
|
||||
"type": "frontend/get_translations",
|
||||
vol.Required("language"): str,
|
||||
vol.Required("category"): str,
|
||||
vol.Optional("integration"): str,
|
||||
vol.Optional("config_flow"): bool,
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
async def websocket_get_translations(hass, connection, msg):
|
||||
@@ -544,7 +550,13 @@ async def websocket_get_translations(hass, connection, msg):
|
||||
|
||||
Async friendly.
|
||||
"""
|
||||
resources = await async_get_translations(hass, msg["language"])
|
||||
resources = await async_get_translations(
|
||||
hass,
|
||||
msg["language"],
|
||||
msg["category"],
|
||||
msg.get("integration"),
|
||||
msg.get("config_flow"),
|
||||
)
|
||||
connection.send_message(
|
||||
websocket_api.result_message(msg["id"], {"resources": resources})
|
||||
)
|
||||
@@ -117,7 +117,7 @@ class UserOnboardingView(_BaseOnboardingView):
|
||||
|
||||
# Create default areas using the users supplied language.
|
||||
translations = await hass.helpers.translation.async_get_translations(
|
||||
data["language"]
|
||||
data["language"], integration=DOMAIN
|
||||
)
|
||||
|
||||
area_registry = await hass.helpers.area_registry.async_get_registry()
|
||||
|
||||
Reference in new issue
Block a user