From d202b7c3c77ef28169fd620f89801deb8b21c29f Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker <joostlek@outlook.com> Date: Fri, 7 Jul 2023 14:40:22 +0200 Subject: [PATCH] Add entity translations to RDW (#96034) --- homeassistant/components/rdw/binary_sensor.py | 4 ++-- homeassistant/components/rdw/sensor.py | 4 ++-- homeassistant/components/rdw/strings.json | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/rdw/binary_sensor.py b/homeassistant/components/rdw/binary_sensor.py index 13a04515143..9d895f35eb7 100644 --- a/homeassistant/components/rdw/binary_sensor.py +++ b/homeassistant/components/rdw/binary_sensor.py @@ -41,13 +41,13 @@ class RDWBinarySensorEntityDescription( BINARY_SENSORS: tuple[RDWBinarySensorEntityDescription, ...] = ( RDWBinarySensorEntityDescription( key="liability_insured", - name="Liability insured", + translation_key="liability_insured", icon="mdi:shield-car", is_on_fn=lambda vehicle: vehicle.liability_insured, ), RDWBinarySensorEntityDescription( key="pending_recall", - name="Pending recall", + translation_key="pending_recall", device_class=BinarySensorDeviceClass.PROBLEM, is_on_fn=lambda vehicle: vehicle.pending_recall, ), diff --git a/homeassistant/components/rdw/sensor.py b/homeassistant/components/rdw/sensor.py index e262665dd63..2c324ca7093 100644 --- a/homeassistant/components/rdw/sensor.py +++ b/homeassistant/components/rdw/sensor.py @@ -42,13 +42,13 @@ class RDWSensorEntityDescription( SENSORS: tuple[RDWSensorEntityDescription, ...] = ( RDWSensorEntityDescription( key="apk_expiration", - name="APK expiration", + translation_key="apk_expiration", device_class=SensorDeviceClass.DATE, value_fn=lambda vehicle: vehicle.apk_expiration, ), RDWSensorEntityDescription( key="ascription_date", - name="Ascription date", + translation_key="ascription_date", device_class=SensorDeviceClass.DATE, value_fn=lambda vehicle: vehicle.ascription_date, ), diff --git a/homeassistant/components/rdw/strings.json b/homeassistant/components/rdw/strings.json index 840802a12b7..cf24ec5115c 100644 --- a/homeassistant/components/rdw/strings.json +++ b/homeassistant/components/rdw/strings.json @@ -14,5 +14,23 @@ "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "unknown_license_plate": "Unknown license plate" } + }, + "entity": { + "binary_sensor": { + "liability_insured": { + "name": "Liability insured" + }, + "pending_recall": { + "name": "Pending recall" + } + }, + "sensor": { + "apk_expiration": { + "name": "APK expiration" + }, + "ascription_date": { + "name": "Ascription date" + } + } } } -- GitLab