Skip to content

Commit

Permalink
fix #70 translation_key bug that not translate the values
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuen Lee committed Jan 9, 2024
1 parent 2b9bdd7 commit 87b5d24
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 44 deletions.
4 changes: 2 additions & 2 deletions custom_components/polestar_api/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ class PolestarSensor(PolestarEntity, SensorEntity):
"""Representation of a Polestar Sensor."""

entity_description: PolestarSensorDescription
attr_has_entity_name = True
_attr_has_entity_name = True

def __init__(self,
device: Polestar,
Expand All @@ -430,7 +430,7 @@ def __init__(self,
#self._attr_name = f"{description.name}"
self._attr_unique_id = f"polestar_{unique_id}-{description.key}"
self.entity_description = description
self.attr_translation_key = f"polestar_{description.key}"
self._attr_translation_key = f"polestar_{description.key}"
self._attr_native_unit_of_measurement = description.native_unit_of_measurement
self._sensor_data = None
self._attr_unit_of_measurement = description.native_unit_of_measurement
Expand Down
5 changes: 2 additions & 3 deletions custom_components/polestar_api/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"description": "Enter Authentication of Polestar EV",
"data": {
"name": "Friendly name",
"username": "Username",
"password": "Password",
"vin": "VIN"
"username": "Username OG",
"password": "Password OG"
}
}
},
Expand Down
34 changes: 13 additions & 21 deletions custom_components/polestar_api/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
"title": "Configure Polestar EV",
"description": "Enter Authentication of Polestar EV",
"data": {
"name": "Friendly name",
"username": "Username",
"password": "Password",
"vin": "VIN"
"password": "Password"
}
}
},
Expand All @@ -21,16 +19,13 @@
},
"entity": {
"sensor": {
"polestar_estimate_distance_to_empty_miles": {
"name": "Distance Miles Remaining"
"polestar_estimate_range": {
"name": "Range"
},
"polestar_estimate_distance_to_empty_km": {
"name": "Distance km Remaining"
},
"polestar_current_odometer_meters": {
"polestar_current_odometer": {
"name": "Odometer"
},
"polestar_average_speed_km_per_hour": {
"polestar_average_speed": {
"name": "Average Speed"
},
"polestar_current_trip_meter_automatic": {
Expand All @@ -42,23 +37,23 @@
"polestar_battery_charge_level": {
"name": "Battery Charge Level"
},
"polestar_estimated_charging_time_to_full_minutes": {
"name": "Estimated Charging Time to Full Minutes"
"polestar_estimated_charging_time_to_full": {
"name": "Charging Time"
},
"polestar_charging_status": {
"name": "Charging Status"
},
"polestar_charging_power_watts": {
"name": "Charging Power Watts"
"polestar_charging_power": {
"name": "Charging Power"
},
"polestar_charging_current_amps": {
"name": "Charging Current Amps"
"polestar_charging_current": {
"name": "Charging Current"
},
"polestar_charger_connection_status": {
"name": "Charger Connection Status"
},
"polestar_average_energy_consumption_kwh_per_100_km": {
"name": "Average Energy Consumption kWh/100km"
"polestar_average_energy_consumption_kwh_per_100": {
"name": "Avg. Energy Consumption"
},
"polestar_estimated_charging_time_minutes_to_target_distance": {
"name": "Estimated Charging Time Minutes to Target Distance"
Expand All @@ -84,9 +79,6 @@
"polestar_last_updated_battery_data": {
"name": "Last Updated Battery Data"
},
"polestar_estimate_full_charge_range_miles": {
"name": "Estimate Full Charge Range Miles"
},
"polestar_estimate_full_charge_range": {
"name": "Estimate Full Charge Range"
},
Expand Down
28 changes: 10 additions & 18 deletions custom_components/polestar_api/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
"config": {
"step": {
"user": {
"title": "Configure Polestar EV",
"description": "Enter Authentication of Polestar EV",
"title": "Configureer Polestar API",
"description": "Vul authenticatie voor Polestar EV",
"data": {
"name": "Friendly name",
"username": "Username",
"password": "Password",
"vin": "VIN"
"username": "Gebruikersnaam",
"password": "Wachtwoord"
}
}
},
Expand All @@ -24,12 +22,6 @@
"polestar_estimate_range": {
"name": "Resterende afstand"
},
"polestar_distance_to_empty_miles": {
"name": "Resterende afstand (mijl)"
},
"polestar_estimate_distance_to_empty_km": {
"name": "Resterende afstand (km)"
},
"polestar_current_odometer": {
"name": "Huidige kilometerstand"
},
Expand All @@ -52,10 +44,10 @@
"name": "Laadstatus"
},
"polestar_charging_power": {
"name": "Laadvermogen (W)"
"name": "Laadvermogen"
},
"polestar_charging_current": {
"name": "Laadstroom (A)"
"name": "Laadstroom"
},
"polestar_charger_connection_status": {
"name": "Laadkabel status"
Expand All @@ -72,6 +64,9 @@
"polestar_registration_number": {
"name": "Registratienummer"
},
"polestar_software_version": {
"name": "Software Versie"
},
"polestar_estimated_fully_charged_time": {
"name": "Geschatte volledig opgeladen tijd"
},
Expand All @@ -84,11 +79,8 @@
"polestar_last_updated_battery_data": {
"name": "Laatst geüpdatete batterijgegevens"
},
"polestar_estimate_full_charge_range_miles": {
"name": "Geschatte volledige laadafstand (mijl)"
},
"polestar_estimate_full_charge_range": {
"name": "Geschatte volledige laadafstand (km)"
"name": "Geschatte volledige laadafstand"
},
"polestar_api_status_code": {
"name": "API Status Code"
Expand Down

0 comments on commit 87b5d24

Please sign in to comment.