Improve translation strings for MQTT config and option flows (#50018)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Erik Montnemery 2021-05-06 06:25:28 +02:00 committed by GitHub
parent d6c300aeb1
commit 7dec23d58b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 10 deletions

View File

@ -65,6 +65,7 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
)
if can_connect:
user_input[CONF_DISCOVERY] = DEFAULT_DISCOVERY
return self.async_create_entry(
title=user_input[CONF_BROKER], data=user_input
)
@ -76,7 +77,6 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
fields[vol.Required(CONF_PORT, default=1883)] = vol.Coerce(int)
fields[vol.Optional(CONF_USERNAME)] = str
fields[vol.Optional(CONF_PASSWORD)] = str
fields[vol.Optional(CONF_DISCOVERY, default=DEFAULT_DISCOVERY)] = bool
return self.async_show_form(
step_id="broker", data_schema=vol.Schema(fields), errors=errors
@ -126,7 +126,7 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
CONF_USERNAME: data.get(CONF_USERNAME),
CONF_PASSWORD: data.get(CONF_PASSWORD),
CONF_PROTOCOL: data.get(CONF_PROTOCOL),
CONF_DISCOVERY: user_input[CONF_DISCOVERY],
CONF_DISCOVERY: DEFAULT_DISCOVERY,
},
)
@ -135,9 +135,6 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
return self.async_show_form(
step_id="hassio_confirm",
description_placeholders={"addon": self._hassio_discovery["addon"]},
data_schema=vol.Schema(
{vol.Optional(CONF_DISCOVERY, default=DEFAULT_DISCOVERY): bool}
),
errors=errors,
)

View File

@ -51,6 +51,7 @@
"options": {
"step": {
"broker": {
"title": "Broker options",
"description": "Please enter the connection information of your MQTT broker.",
"data": {
"broker": "Broker",
@ -60,7 +61,8 @@
}
},
"options": {
"description": "Please select MQTT options.",
"title": "MQTT options",
"description": "Discovery - If discovery is enabled (recommended), Home Assistant will automatically discover devices and entities which publish their configuration on the MQTT broker. If discovery is disabled, all configuration must be done manually.\nBirth message - The birth message will be sent each time Home Assistant (re)connects to the MQTT broker.\nWill message - The will message will be sent each time Home Assistant loses its connection to the broker, both in case of a clean (e.g. Home Assistant shutting down) and in case of an unclean (e.g. Home Assistant crashing or losing its network connection) disconnect.",
"data": {
"discovery": "Enable discovery",
"birth_enable": "Enable birth message",

View File

@ -15,7 +15,7 @@
"port": "Port",
"username": "Username"
},
"description": "Please enter the connection information of your MQTT broker."
"description": "Please enter the connection information of your MQTT broker and select if MQTT discovery should be enabled (recommended). If discovery is enabled, Home Assistant will automatically discover devices and entities which publish their configuration on the MQTT broker. If discovery is disabled, all configuration must be done manually."
},
"hassio_confirm": {
"data": {
@ -62,7 +62,8 @@
"port": "Port",
"username": "Username"
},
"description": "Please enter the connection information of your MQTT broker."
"description": "Please enter the connection information of your MQTT broker.",
"title": "Broker options"
},
"options": {
"data": {
@ -78,8 +79,9 @@
"will_retain": "Will message retain",
"will_topic": "Will message topic"
},
"description": "Please select MQTT options."
"description": "### Discovery \n If discovery is enabled (recommended), Home Assistant will automatically discover devices and entities which publish their configuration on the MQTT broker. If discovery is disabled, all configuration must be done manually. \n ### Birth message\n The birth message will be sent each time Home Assistant (re)connects to the MQTT broker. \n ### Will message \n The will message will be sent each time Home Assistant loses its connection to the broker, both in case of a clean (e.g. Home Assistant shutting down) and in case of an unclean (e.g. Home Assistant crashing or losing its network connection) disconnect.",
"title": "MQTT options"
}
}
}
}
}