mirror of
https://github.com/home-assistant/core.git
synced 2026-04-20 16:39:02 +02:00
Make huawei_lte button and select names translatable (#155058)
This commit is contained in:
@@ -70,7 +70,7 @@ class ClearTrafficStatisticsButton(BaseButton):
|
||||
|
||||
entity_description = ButtonEntityDescription(
|
||||
key=BUTTON_KEY_CLEAR_TRAFFIC_STATISTICS,
|
||||
name="Clear traffic statistics",
|
||||
translation_key="clear_traffic_statistics",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
)
|
||||
|
||||
@@ -87,7 +87,6 @@ class RestartButton(BaseButton):
|
||||
|
||||
entity_description = ButtonEntityDescription(
|
||||
key=BUTTON_KEY_RESTART,
|
||||
name="Restart",
|
||||
device_class=ButtonDeviceClass.RESTART,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
)
|
||||
|
||||
@@ -61,9 +61,7 @@ rules:
|
||||
entity-category: done
|
||||
entity-device-class: done
|
||||
entity-disabled-by-default: done
|
||||
entity-translations:
|
||||
status: todo
|
||||
comment: Buttons and selects are lacking translations.
|
||||
entity-translations: done
|
||||
exception-translations: todo
|
||||
icon-translations:
|
||||
status: done
|
||||
|
||||
@@ -19,7 +19,6 @@ from homeassistant.const import EntityCategory
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
from homeassistant.helpers.typing import UNDEFINED
|
||||
|
||||
from . import Router
|
||||
from .const import DOMAIN, KEY_NET_NET_MODE
|
||||
@@ -47,7 +46,6 @@ async def async_setup_entry(
|
||||
desc = HuaweiSelectEntityDescription(
|
||||
key=KEY_NET_NET_MODE,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
name="Preferred network mode",
|
||||
translation_key="preferred_network_mode",
|
||||
options=[
|
||||
NetworkModeEnum.MODE_AUTO.value,
|
||||
@@ -95,11 +93,6 @@ class HuaweiLteSelectEntity(HuaweiLteBaseEntityWithDevice, SelectEntity):
|
||||
self.key = key
|
||||
self.item = item
|
||||
|
||||
name = None
|
||||
if self.entity_description.name != UNDEFINED:
|
||||
name = self.entity_description.name
|
||||
self._attr_name = name or self.item
|
||||
|
||||
def select_option(self, option: str) -> None:
|
||||
"""Change the selected option."""
|
||||
self.entity_description.setter_fn(option)
|
||||
|
||||
@@ -68,6 +68,11 @@
|
||||
"name": "Wi-Fi status"
|
||||
}
|
||||
},
|
||||
"button": {
|
||||
"clear_traffic_statistics": {
|
||||
"name": "Clear traffic statistics"
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
"preferred_network_mode": {
|
||||
"name": "Preferred network mode",
|
||||
|
||||
Reference in New Issue
Block a user