From 316ac6253bfc0132220d39df5d8c78a972e26e4c Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 22 Jul 2025 19:06:14 +0200 Subject: [PATCH] Use translation_placeholders in tuya number descriptions (#149250) --- homeassistant/components/tuya/number.py | 30 ++++++++++++++-------- homeassistant/components/tuya/strings.json | 14 +++------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/homeassistant/components/tuya/number.py b/homeassistant/components/tuya/number.py index 415299307e3..383ece6eaee 100644 --- a/homeassistant/components/tuya/number.py +++ b/homeassistant/components/tuya/number.py @@ -266,32 +266,38 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = { "tgkg": ( NumberEntityDescription( key=DPCode.BRIGHTNESS_MIN_1, - translation_key="minimum_brightness", + translation_key="indexed_minimum_brightness", + translation_placeholders={"index": "1"}, entity_category=EntityCategory.CONFIG, ), NumberEntityDescription( key=DPCode.BRIGHTNESS_MAX_1, - translation_key="maximum_brightness", + translation_key="indexed_maximum_brightness", + translation_placeholders={"index": "1"}, entity_category=EntityCategory.CONFIG, ), NumberEntityDescription( key=DPCode.BRIGHTNESS_MIN_2, - translation_key="minimum_brightness_2", + translation_key="indexed_minimum_brightness", + translation_placeholders={"index": "2"}, entity_category=EntityCategory.CONFIG, ), NumberEntityDescription( key=DPCode.BRIGHTNESS_MAX_2, - translation_key="maximum_brightness_2", + translation_key="indexed_maximum_brightness", + translation_placeholders={"index": "2"}, entity_category=EntityCategory.CONFIG, ), NumberEntityDescription( key=DPCode.BRIGHTNESS_MIN_3, - translation_key="minimum_brightness_3", + translation_key="indexed_minimum_brightness", + translation_placeholders={"index": "3"}, entity_category=EntityCategory.CONFIG, ), NumberEntityDescription( key=DPCode.BRIGHTNESS_MAX_3, - translation_key="maximum_brightness_3", + translation_key="indexed_maximum_brightness", + translation_placeholders={"index": "3"}, entity_category=EntityCategory.CONFIG, ), ), @@ -300,22 +306,26 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = { "tgq": ( NumberEntityDescription( key=DPCode.BRIGHTNESS_MIN_1, - translation_key="minimum_brightness", + translation_key="indexed_minimum_brightness", + translation_placeholders={"index": "1"}, entity_category=EntityCategory.CONFIG, ), NumberEntityDescription( key=DPCode.BRIGHTNESS_MAX_1, - translation_key="maximum_brightness", + translation_key="indexed_maximum_brightness", + translation_placeholders={"index": "1"}, entity_category=EntityCategory.CONFIG, ), NumberEntityDescription( key=DPCode.BRIGHTNESS_MIN_2, - translation_key="minimum_brightness_2", + translation_key="indexed_minimum_brightness", + translation_placeholders={"index": "2"}, entity_category=EntityCategory.CONFIG, ), NumberEntityDescription( key=DPCode.BRIGHTNESS_MAX_2, - translation_key="maximum_brightness_2", + translation_key="indexed_maximum_brightness", + translation_placeholders={"index": "2"}, entity_category=EntityCategory.CONFIG, ), ), diff --git a/homeassistant/components/tuya/strings.json b/homeassistant/components/tuya/strings.json index 6a7f6433d03..a797b9e6637 100644 --- a/homeassistant/components/tuya/strings.json +++ b/homeassistant/components/tuya/strings.json @@ -199,17 +199,11 @@ "maximum_brightness": { "name": "Maximum brightness" }, - "minimum_brightness_2": { - "name": "Minimum brightness 2" + "indexed_minimum_brightness": { + "name": "Minimum brightness {index}" }, - "maximum_brightness_2": { - "name": "Maximum brightness 2" - }, - "minimum_brightness_3": { - "name": "Minimum brightness 3" - }, - "maximum_brightness_3": { - "name": "Maximum brightness 3" + "indexed_maximum_brightness": { + "name": "Maximum brightness {index}" }, "move_down": { "name": "Move down"