Skip to content

Commit

Permalink
resolve translations
Browse files Browse the repository at this point in the history
  • Loading branch information
pantherale0 committed Dec 20, 2023
1 parent c34eee9 commit 850b31f
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 14 deletions.
21 changes: 9 additions & 12 deletions custom_components/fuel_prices/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async def async_step_main_menu(self, _: None = None):
step_id="main_menu",
menu_options={
"area_menu": "Configure areas to create devices/sensors",
CONF_SOURCES: "Configure data collector sources",
"sources": "Configure data collector sources",
"finished": "Complete setup",
},
)
Expand All @@ -83,7 +83,7 @@ async def async_step_sources(self, user_input: dict[str, Any] | None = None):
self.configured_sources = user_input[CONF_SOURCES]
return await self.async_step_main_menu(None)
return self.async_show_form(
step_id=CONF_SOURCES,
step_id="sources",
data_schema=vol.Schema(
{
vol.Optional(
Expand All @@ -103,12 +103,12 @@ async def async_step_area_menu(self, _: None = None) -> FlowResult:
"""Show the area menu."""
return self.async_show_menu(
step_id="area_menu",
menu_options=[
"area_create",
"area_update_select",
"area_delete",
"main_menu",
],
menu_options={
"area_create": "Define a new area",
"area_update_select": "Update an area",
"area_delete": "Delete an area",
"main_menu": "Return to main menu",
},
)

async def async_step_area_create(self, user_input: dict[str, Any] | None = None):
Expand Down Expand Up @@ -239,10 +239,7 @@ async def async_step_finished(self, user_input: dict[str, Any] | None = None):
)
user_input[CONF_AREAS] = self.configured_areas
return self.async_create_entry(title=NAME, data=user_input)
return self.async_show_form(
step_id="finished",
errors=errors,
)
return self.async_show_form(step_id="finished", errors=errors, last_step=True)


class CannotConnect(HomeAssistantError):
Expand Down
8 changes: 6 additions & 2 deletions custom_components/fuel_prices/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"title": "Fuel Prices",
"config": {
"step": {
"main_menu": {
"description": "Select a configuration option to get started. Once completed, select the last option to complete setup."
"finished": {
"title": "Fuel Prices",
"description": "Click submit to finish setup"
},
"sources": {
"title": "Configure data collection sources",
Expand Down Expand Up @@ -55,6 +56,9 @@
}
}
},
"error": {
"already_configured": "Only one instance of this integration is allowed."
},
"services": {
"find_fuels": {
"name": "Find fuel prices from location",
Expand Down
88 changes: 88 additions & 0 deletions custom_components/fuel_prices/translations/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"title": "Fuel Prices",
"config": {
"step": {
"finished": {
"title": "Fuel Prices",
"description": "Click submit to finish setup"
},
"sources": {
"title": "Configure data collection sources",
"description": "Using this menu you can change what providers the integration will collect data from.",
"data": {
"sources": "Data source(s)"
}
},
"area_menu": {
"title": "Configure areas to register devices and sensors",
"menu_options": {
"area_create": "Create an area",
"area_update_select": "Update an area",
"area_delete": "Delete an area",
"main_menu": "Return to main menu"
}
},
"area_create": {
"title": "Create an area",
"description": "Using this menu you can create areas to register devices and sensors. This integration will create a device for each fuel station discovered, under this a sensor will be created for each fuel type.",
"data": {
"name": "Area name (must be unique)",
"radius": "Maximum search radius",
"latitude": "Latitude for the center of the search location",
"longitude": "Longitude for the center of the search location"
}
},
"area_update_select": {
"title": "Select area to update",
"data": {
"name": "Area name"
}
},
"area_update": {
"title": "Create an area",
"description": "Using this menu you can create areas to register devices and sensors. This integration will create a device for each fuel station discovered, under this a sensor will be created for each fuel type.",
"data": {
"name": "Area name (must be unique)",
"radius": "Maximum search radius",
"latitude": "Latitude for the center of the search location",
"longitude": "Longitude for the center of the search location"
}
},
"area_delete": {
"title": "Select area to delete",
"data": {
"name": "Area name"
}
}
}
},
"error": {
"already_configured": "Only one instance of this integration is allowed."
},
"services": {
"find_fuels": {
"name": "Find fuel prices from location",
"description": "This will retrieve all fuel prices for a given location sorted by the cheapest first.",
"fields": {
"location": {
"name": "Location",
"description": "The location of the area to search"
},
"type": {
"name": "Fuel Type",
"description": "The fuel type to search for (such as E5, E10, B7, SDV)"
}
}
},
"find_fuel_station": {
"name": "Find fuel stations from location",
"description": "Find all of the available fuel stations, alongside available fuels and cost for a given location. The results are not sorted.",
"fields": {
"location": {
"name": "Location",
"description": "The location of the area to search"
}
}
}
}
}

0 comments on commit 850b31f

Please sign in to comment.