From 1b4fda232176dc2d417f99efe8639b3af991d947 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Tue, 24 Jan 2023 13:11:11 +0100 Subject: [PATCH] Add translations for type select selector min_max config and option flow (#86213) * Add translations for type select selector min_max * Remove redundant labels --- .../components/min_max/config_flow.py | 18 ++++++++++-------- homeassistant/components/min_max/strings.json | 13 +++++++++++++ .../components/min_max/translations/en.json | 15 ++++++++++++++- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/min_max/config_flow.py b/homeassistant/components/min_max/config_flow.py index b515608042f..f449c98819e 100644 --- a/homeassistant/components/min_max/config_flow.py +++ b/homeassistant/components/min_max/config_flow.py @@ -19,13 +19,13 @@ from homeassistant.helpers.schema_config_entry_flow import ( from .const import CONF_ENTITY_IDS, CONF_ROUND_DIGITS, DOMAIN _STATISTIC_MEASURES = [ - selector.SelectOptionDict(value="min", label="Minimum"), - selector.SelectOptionDict(value="max", label="Maximum"), - selector.SelectOptionDict(value="mean", label="Arithmetic mean"), - selector.SelectOptionDict(value="median", label="Median"), - selector.SelectOptionDict(value="last", label="Most recently updated"), - selector.SelectOptionDict(value="range", label="Statistical range"), - selector.SelectOptionDict(value="sum", label="Sum"), + "min", + "max", + "mean", + "median", + "last", + "range", + "sum", ] @@ -38,7 +38,9 @@ OPTIONS_SCHEMA = vol.Schema( ), ), vol.Required(CONF_TYPE): selector.SelectSelector( - selector.SelectSelectorConfig(options=_STATISTIC_MEASURES), + selector.SelectSelectorConfig( + options=_STATISTIC_MEASURES, translation_key=CONF_TYPE + ), ), vol.Required(CONF_ROUND_DIGITS, default=2): selector.NumberSelector( selector.NumberSelectorConfig( diff --git a/homeassistant/components/min_max/strings.json b/homeassistant/components/min_max/strings.json index 67e8416bc2c..c76a6faf2f5 100644 --- a/homeassistant/components/min_max/strings.json +++ b/homeassistant/components/min_max/strings.json @@ -30,5 +30,18 @@ } } } + }, + "selector": { + "type": { + "options": { + "min": "Minimum", + "max": "Maximum", + "mean": "Arithmetic mean", + "median": "Median", + "last": "Most recently updated", + "range": "Statistical range", + "sum": "Sum" + } + } } } diff --git a/homeassistant/components/min_max/translations/en.json b/homeassistant/components/min_max/translations/en.json index 6c661c980c0..0bb5008a721 100644 --- a/homeassistant/components/min_max/translations/en.json +++ b/homeassistant/components/min_max/translations/en.json @@ -30,5 +30,18 @@ } } }, - "title": "Combine the state of several sensors" + "title": "Combine the state of several sensors", + "selector": { + "type": { + "options":{ + "min": "Minimum", + "max": "Maximum", + "mean": "Arithmetic mean", + "median": "Median", + "last": "Most recently updated", + "range": "Statistical range", + "sum": "Sum" + } + } + } } \ No newline at end of file