Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
修改部分翻译
Browse files Browse the repository at this point in the history
  • Loading branch information
dscao authored May 19, 2023
1 parent c34c80d commit 3c265d8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 15 deletions.
3 changes: 1 addition & 2 deletions custom_components/gooddriver/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@


SENSOR_LIST = {
KEY_PARKING_TIME: "Parking_time",
KEY_PARKING_TIME: "parkingtime"
}


@config_entries.HANDLERS.register(DOMAIN)
class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
@staticmethod
Expand Down
9 changes: 4 additions & 5 deletions custom_components/gooddriver/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription(
key=KEY_ADDRESS,
name="Address",
name="address",
icon="mdi:map"
),
SensorEntityDescription(
key=KEY_PARKING_TIME,
name="Parking time",
name="parkingtime",
icon="mdi:timer-stop-outline"
)
)
Expand Down Expand Up @@ -76,8 +76,6 @@ class gooddriverSensorEntity(CoordinatorEntity):
"""Define an bjtoon_health_code entity."""

_attr_has_entity_name = True

#_attr_translation_key = "gooddriver_sensor"

def __init__(self, device_name, description, coordinator):
"""Initialize."""
Expand All @@ -89,7 +87,8 @@ def __init__(self, device_name, description, coordinator):

_LOGGER.debug("SensorEntity coordinator: %s", coordinator.data)

self._attr_name = f"{self.entity_description.name}"
#self._attr_name = f"{self.entity_description.name}"
self._attr_translation_key = f"{self.entity_description.name}"
if self.entity_description.key == KEY_PARKING_TIME:
self._state = self.coordinator.data.get(ATTR_PARKING_TIME)
elif self.entity_description.key == KEY_ADDRESS:
Expand Down
15 changes: 14 additions & 1 deletion custom_components/gooddriver/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
}
}
},
"selector": {
"sensors": {
"options": {
"last_update": "Last update",
"parkingtime": "Parking Time"
}
}
},
"entity": {
"device_tracker": {
"gooddriver_device_tracker": {
Expand Down Expand Up @@ -103,7 +111,12 @@
"name": "Address"
},
"gooddriver_parkingtime":{
"name": "Parking Time"
"name": "Parking Time",
"state_attributes": {
"querytime": {
"name": "query time"
}
}
},
"gooddriver_querytime":{
"name": "Query Time"
Expand Down
24 changes: 17 additions & 7 deletions custom_components/gooddriver/translations/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
}
}
},
"selector": {
"sensors": {
"options": {
"last_update": "最后更新",
"parkingtime": "停车时长"
}
}
},
"entity": {
"device_tracker": {
"gooddriver_device_tracker": {
Expand Down Expand Up @@ -99,14 +107,16 @@
}
},
"sensor": {
"gooddriver_address":{
"name": "地址"
},
"gooddriver_parkingtime":{
"name": "停车时长"
"parkingtime": {
"name": "停车时长",
"state_attributes": {
"querytime": {
"name": "查询时间"
}
}
},
"gooddriver_querytime":{
"name": "查询时间"
"last_update": {
"name": "最后更新"
}
}

Expand Down

0 comments on commit 3c265d8

Please sign in to comment.