Skip to content

Commit d0c0247

Browse files
sairamsharanfrenck
andauthored
Move PS4 URLs out of translatable strings (#154969)
Co-authored-by: Franck Nijhof <git@frenck.dev>
1 parent b116619 commit d0c0247

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

homeassistant/components/ps4/config_flow.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
DEFAULT_ALIAS,
2727
DEFAULT_NAME,
2828
DOMAIN,
29+
PS4_DOCS_URL,
2930
)
3031

3132
CONF_MODE = "Config Mode"
@@ -66,7 +67,10 @@ async def async_step_user(
6667
failed = await self.hass.async_add_executor_job(self.helper.port_bind, ports)
6768
if failed in ports:
6869
reason = PORT_MSG[failed]
69-
return self.async_abort(reason=reason)
70+
return self.async_abort(
71+
reason=reason,
72+
description_placeholders={"ps4_docs_url": PS4_DOCS_URL},
73+
)
7074
return await self.async_step_creds()
7175

7276
async def async_step_creds(
@@ -85,7 +89,11 @@ async def async_step_creds(
8589
except CredentialTimeout:
8690
errors["base"] = "credential_timeout"
8791

88-
return self.async_show_form(step_id="creds", errors=errors)
92+
return self.async_show_form(
93+
step_id="creds",
94+
errors=errors,
95+
description_placeholders={"ps4_docs_url": PS4_DOCS_URL},
96+
)
8997

9098
async def async_step_mode(
9199
self, user_input: dict[str, Any] | None = None

homeassistant/components/ps4/const.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
if TYPE_CHECKING:
1010
from . import PS4Data
1111

12+
PS4_DOCS_URL = "https://www.home-assistant.io/components/ps4/"
13+
1214
ATTR_MEDIA_IMAGE_URL = "media_image_url"
1315
CONFIG_ENTRY_VERSION = 3
1416
DEFAULT_NAME = "PlayStation 4"

homeassistant/components/ps4/strings.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
"config": {
33
"step": {
44
"creds": {
5-
"description": "Credentials needed. Select **Submit** and then in the PS4 2nd Screen App, refresh devices and select the **Home-Assistant** device to continue."
5+
"description": "Credentials needed. Select **Submit** and then in the PS4 2nd Screen App, refresh devices and select the **Home-Assistant** device to continue.",
6+
"data": {
7+
"token": "PSN Token"
8+
},
9+
"data_description": {
10+
"token": "To get your PSN token, please follow these [instructions]({ps4_docs_url})."
11+
}
612
},
713
"mode": {
814
"data": {
@@ -35,8 +41,8 @@
3541
"credential_error": "Error fetching credentials.",
3642
"no_devices_found": "[%key:common::config_flow::abort::no_devices_found%]",
3743
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
38-
"port_987_bind_error": "Could not bind to port 987. Refer to the [documentation](https://www.home-assistant.io/components/ps4/) for additional info.",
39-
"port_997_bind_error": "Could not bind to port 997. Refer to the [documentation](https://www.home-assistant.io/components/ps4/) for additional info."
44+
"port_987_bind_error": "Could not bind to port 987. Refer to the [documentation]({ps4_docs_url}) for additional info.",
45+
"port_997_bind_error": "Could not bind to port 997. Refer to the [documentation]({ps4_docs_url}) for additional info."
4046
}
4147
},
4248
"services": {

0 commit comments

Comments
 (0)