mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Add translation support for select selectors of derivative config and option flow (#86190)
* Add translation support for derivative config flow * Revert translation support for SI units * Undo test changes * Remove redundant labels
This commit is contained in:
parent
1b1f8a1d61
commit
8d678209db
@ -34,10 +34,10 @@ UNIT_PREFIXES = [
|
|||||||
selector.SelectOptionDict(value="P", label="P (peta)"),
|
selector.SelectOptionDict(value="P", label="P (peta)"),
|
||||||
]
|
]
|
||||||
TIME_UNITS = [
|
TIME_UNITS = [
|
||||||
selector.SelectOptionDict(value=UnitOfTime.SECONDS, label="Seconds"),
|
UnitOfTime.SECONDS,
|
||||||
selector.SelectOptionDict(value=UnitOfTime.MINUTES, label="Minutes"),
|
UnitOfTime.MINUTES,
|
||||||
selector.SelectOptionDict(value=UnitOfTime.HOURS, label="Hours"),
|
UnitOfTime.HOURS,
|
||||||
selector.SelectOptionDict(value=UnitOfTime.DAYS, label="Days"),
|
UnitOfTime.DAYS,
|
||||||
]
|
]
|
||||||
|
|
||||||
OPTIONS_SCHEMA = vol.Schema(
|
OPTIONS_SCHEMA = vol.Schema(
|
||||||
@ -55,7 +55,9 @@ OPTIONS_SCHEMA = vol.Schema(
|
|||||||
selector.SelectSelectorConfig(options=UNIT_PREFIXES),
|
selector.SelectSelectorConfig(options=UNIT_PREFIXES),
|
||||||
),
|
),
|
||||||
vol.Required(CONF_UNIT_TIME, default=UnitOfTime.HOURS): selector.SelectSelector(
|
vol.Required(CONF_UNIT_TIME, default=UnitOfTime.HOURS): selector.SelectSelector(
|
||||||
selector.SelectSelectorConfig(options=TIME_UNITS),
|
selector.SelectSelectorConfig(
|
||||||
|
options=TIME_UNITS, translation_key="time_unit"
|
||||||
|
),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -39,5 +39,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"selector": {
|
||||||
|
"time_unit": {
|
||||||
|
"options": {
|
||||||
|
"s": "Seconds",
|
||||||
|
"min": "Minutes",
|
||||||
|
"h": "Hours",
|
||||||
|
"d": "Days"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,5 +39,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"title": "Derivative sensor"
|
"title": "Derivative sensor",
|
||||||
|
"selector": {
|
||||||
|
"time_unit": {
|
||||||
|
"options": {
|
||||||
|
"s": "Seconds",
|
||||||
|
"min": "Minutes",
|
||||||
|
"h": "Hours",
|
||||||
|
"d": "Days"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user