mirror of
https://github.com/home-assistant/core.git
synced 2025-08-31 18:31:35 +02:00
Remove country argument
This commit is contained in:
@@ -357,7 +357,6 @@ def _get_unmatched_slots(
|
|||||||
{
|
{
|
||||||
vol.Required("type"): "conversation/agent/homeassistant/language_scores",
|
vol.Required("type"): "conversation/agent/homeassistant/language_scores",
|
||||||
vol.Optional("language"): str,
|
vol.Optional("language"): str,
|
||||||
vol.Optional("country"): str,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@websocket_api.async_response
|
@websocket_api.async_response
|
||||||
@@ -368,10 +367,9 @@ async def websocket_hass_agent_language_scores(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Get support scores per language."""
|
"""Get support scores per language."""
|
||||||
language = msg.get("language", hass.config.language)
|
language = msg.get("language", hass.config.language)
|
||||||
country = msg.get("country", hass.config.country)
|
|
||||||
|
|
||||||
scores = await hass.async_add_executor_job(get_language_scores)
|
scores = await hass.async_add_executor_job(get_language_scores)
|
||||||
matching_langs = language_util.matches(language, scores.keys(), country=country)
|
matching_langs = language_util.matches(language, scores.keys())
|
||||||
preferred_lang = matching_langs[0] if matching_langs else language
|
preferred_lang = matching_langs[0] if matching_langs else language
|
||||||
result = {
|
result = {
|
||||||
"languages": {
|
"languages": {
|
||||||
|
@@ -646,35 +646,6 @@ async def test_ws_hass_agent_custom_sentences(
|
|||||||
custom_sentences = msg["result"]
|
custom_sentences = msg["result"]
|
||||||
assert custom_sentences.keys() == {"nl"}
|
assert custom_sentences.keys() == {"nl"}
|
||||||
|
|
||||||
# British English is first
|
|
||||||
await client.send_json_auto_id(
|
|
||||||
{
|
|
||||||
"type": "conversation/agent/homeassistant/custom_sentences",
|
|
||||||
"language": "en",
|
|
||||||
"country": "GB",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
msg = await client.receive_json()
|
|
||||||
|
|
||||||
assert msg["success"]
|
|
||||||
assert msg["result"] == snapshot
|
|
||||||
custom_sentences = msg["result"]
|
|
||||||
assert list(custom_sentences.keys()) == ["en-GB", "en"]
|
|
||||||
|
|
||||||
# General English is first
|
|
||||||
await client.send_json_auto_id(
|
|
||||||
{
|
|
||||||
"type": "conversation/agent/homeassistant/custom_sentences",
|
|
||||||
"language": "en",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
msg = await client.receive_json()
|
|
||||||
|
|
||||||
assert msg["success"]
|
|
||||||
assert msg["result"] == snapshot
|
|
||||||
custom_sentences = msg["result"]
|
|
||||||
assert list(custom_sentences.keys()) == ["en", "en-GB"]
|
|
||||||
|
|
||||||
|
|
||||||
def _load_custom_sentences(hass: HomeAssistant) -> dict[str, dict[str, Any]]:
|
def _load_custom_sentences(hass: HomeAssistant) -> dict[str, dict[str, Any]]:
|
||||||
"""Loads custom sentences from testing_config/custom_sentences."""
|
"""Loads custom sentences from testing_config/custom_sentences."""
|
||||||
|
Reference in New Issue
Block a user