Skip to content

Commit 66bb0db

Browse files
akanksha106-codejbouwh
authored andcommitted
Move translatable URL out of strings.json for airnow integration (home-assistant#154557)
Co-authored-by: jbouwh <[email protected]>
1 parent 56ae579 commit 66bb0db

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

homeassistant/components/airnow/config_flow.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
_LOGGER = logging.getLogger(__name__)
2727

2828

29+
# Documentation URL for API key generation
30+
_API_KEY_URL = "https://docs.airnowapi.org/account/request/"
31+
32+
2933
async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> bool:
3034
"""Validate the user input allows us to connect.
3135
@@ -114,6 +118,7 @@ async def async_step_user(
114118
),
115119
}
116120
),
121+
description_placeholders={"api_key_url": _API_KEY_URL},
117122
errors=errors,
118123
)
119124

homeassistant/components/airnow/strings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"config": {
33
"step": {
44
"user": {
5-
"description": "To generate API key go to https://docs.airnowapi.org/account/request/",
5+
"description": "To generate API key go to {api_key_url}",
66
"data": {
77
"api_key": "[%key:common::config_flow::data::api_key%]",
88
"latitude": "[%key:common::config_flow::data::latitude%]",

tests/components/airnow/test_config_flow.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ async def test_form(
2525
)
2626
assert result["type"] is FlowResultType.FORM
2727
assert result["errors"] == {}
28+
assert result["description_placeholders"] == {
29+
"api_key_url": "https://docs.airnowapi.org/account/request/"
30+
}
2831

2932
result2 = await hass.config_entries.flow.async_configure(result["flow_id"], config)
3033
assert result2["type"] is FlowResultType.CREATE_ENTRY

0 commit comments

Comments
 (0)