mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Use translation placeholders in Swiss public transport (#106416)
This commit is contained in:
parent
65e8bbacc9
commit
f92e732f27
@ -15,7 +15,7 @@ from homeassistant.data_entry_flow import FlowResult
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from .const import CONF_DESTINATION, CONF_START, DOMAIN
|
||||
from .const import CONF_DESTINATION, CONF_START, DOMAIN, PLACEHOLDERS
|
||||
|
||||
DATA_SCHEMA = vol.Schema(
|
||||
{
|
||||
@ -65,7 +65,10 @@ class SwissPublicTransportConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
)
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
||||
step_id="user",
|
||||
data_schema=DATA_SCHEMA,
|
||||
errors=errors,
|
||||
description_placeholders=PLACEHOLDERS,
|
||||
)
|
||||
|
||||
async def async_step_import(self, import_input: dict[str, Any]) -> FlowResult:
|
||||
|
@ -7,3 +7,9 @@ CONF_DESTINATION = "to"
|
||||
CONF_START = "from"
|
||||
|
||||
DEFAULT_NAME = "Next Destination"
|
||||
|
||||
|
||||
PLACEHOLDERS = {
|
||||
"stationboard_url": "http://transport.opendata.ch/examples/stationboard.html",
|
||||
"opendata_url": "http://transport.opendata.ch",
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ from homeassistant.helpers.issue_registry import IssueSeverity, async_create_iss
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import CONF_DESTINATION, CONF_START, DEFAULT_NAME, DOMAIN
|
||||
from .const import CONF_DESTINATION, CONF_START, DEFAULT_NAME, DOMAIN, PLACEHOLDERS
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -104,11 +104,12 @@ async def async_setup_platform(
|
||||
issue_domain=DOMAIN,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key=f"deprecated_yaml_import_issue_${result['reason']}",
|
||||
translation_placeholders=PLACEHOLDERS,
|
||||
)
|
||||
|
||||
|
||||
class SwissPublicTransportSensor(SensorEntity):
|
||||
"""Implementation of an Swiss public transport sensor."""
|
||||
"""Implementation of a Swiss public transport sensor."""
|
||||
|
||||
_attr_attribution = "Data provided by transport.opendata.ch"
|
||||
_attr_icon = "mdi:bus"
|
||||
|
@ -2,13 +2,13 @@
|
||||
"config": {
|
||||
"error": {
|
||||
"cannot_connect": "Cannot connect to server",
|
||||
"bad_config": "Request failed due to bad config: Check at [stationboard](http://transport.opendata.ch/examples/stationboard.html) if your station names are valid",
|
||||
"bad_config": "Request failed due to bad config: Check at [stationboard]({stationboard_url}) if your station names are valid",
|
||||
"unknown": "An unknown error was raised by python-opendata-transport"
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]",
|
||||
"cannot_connect": "Cannot connect to server",
|
||||
"bad_config": "Request failed due to bad config: Check at [stationboard](http://transport.opendata.ch/examples/stationboard.html) if your station names are valid",
|
||||
"bad_config": "Request failed due to bad config: Check the [stationboard]({stationboard_url}) for valid stations.",
|
||||
"unknown": "An unknown error was raised by python-opendata-transport"
|
||||
},
|
||||
"step": {
|
||||
@ -17,7 +17,7 @@
|
||||
"from": "Start station",
|
||||
"to": "End station"
|
||||
},
|
||||
"description": "Provide start and end station for your connection\n\nCheck here for valid stations: [stationboard](http://transport.opendata.ch/examples/stationboard.html)",
|
||||
"description": "Provide start and end station for your connection\n\nCheck the [stationboard]({stationboard_url}) for valid stations.",
|
||||
"title": "Swiss Public Transport"
|
||||
}
|
||||
}
|
||||
@ -25,11 +25,11 @@
|
||||
"issues": {
|
||||
"deprecated_yaml_import_issue_cannot_connect": {
|
||||
"title": "The swiss public transport YAML configuration import cannot connect to server",
|
||||
"description": "Configuring swiss public transport using YAML is being removed but there was an connection error importing your YAML configuration.\n\nMake sure your home assistant can reach the [opendata server](http://transport.opendata.ch). In case the server is down, try again later."
|
||||
"description": "Configuring swiss public transport using YAML is being removed but there was an connection error importing your YAML configuration.\n\nMake sure your home assistant can reach the [opendata server]({opendata_url}). In case the server is down, try again later."
|
||||
},
|
||||
"deprecated_yaml_import_issue_bad_config": {
|
||||
"title": "The swiss public transport YAML configuration import request failed due to bad config",
|
||||
"description": "Configuring swiss public transport using YAML is being removed but there was bad config imported in your YAML configuration..\n\nCheck here for valid stations: [stationboard](http://transport.opendata.ch/examples/stationboard.html)"
|
||||
"description": "Configuring swiss public transport using YAML is being removed but there was bad config imported in your YAML configuration.\n\nCheck the [stationboard]({stationboard_url}) for valid stations."
|
||||
},
|
||||
"deprecated_yaml_import_issue_unknown": {
|
||||
"title": "The swiss public transport YAML configuration import failed with unknown error raised by python-opendata-transport",
|
||||
|
Loading…
x
Reference in New Issue
Block a user