Skip to content

Commit

Permalink
Make Switch as x platform options translatable (#130443)
Browse files Browse the repository at this point in the history
Make Switch as x options translatable
  • Loading branch information
joostlek authored Nov 14, 2024
1 parent a97090e commit a1e3c75
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
16 changes: 9 additions & 7 deletions homeassistant/components/switch_as_x/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
from .const import CONF_INVERT, CONF_TARGET_DOMAIN, DOMAIN

TARGET_DOMAIN_OPTIONS = [
selector.SelectOptionDict(value=Platform.COVER, label="Cover"),
selector.SelectOptionDict(value=Platform.FAN, label="Fan"),
selector.SelectOptionDict(value=Platform.LIGHT, label="Light"),
selector.SelectOptionDict(value=Platform.LOCK, label="Lock"),
selector.SelectOptionDict(value=Platform.SIREN, label="Siren"),
selector.SelectOptionDict(value=Platform.VALVE, label="Valve"),
Platform.COVER,
Platform.FAN,
Platform.LIGHT,
Platform.LOCK,
Platform.SIREN,
Platform.VALVE,
]

CONFIG_FLOW = {
Expand All @@ -35,7 +35,9 @@
),
vol.Optional(CONF_INVERT, default=False): selector.BooleanSelector(),
vol.Required(CONF_TARGET_DOMAIN): selector.SelectSelector(
selector.SelectSelectorConfig(options=TARGET_DOMAIN_OPTIONS),
selector.SelectSelectorConfig(
options=TARGET_DOMAIN_OPTIONS, translation_key="target_domain"
),
),
}
)
Expand Down
12 changes: 12 additions & 0 deletions homeassistant/components/switch_as_x/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,17 @@
}
}
}
},
"selector": {
"target_domain": {
"options": {
"cover": "[%key:component::cover::title%]",
"fan": "[%key:component::fan::title%]",
"light": "[%key:component::light::title%]",
"lock": "[%key:component::lock::title%]",
"siren": "[%key:component::siren::title%]",
"valve": "[%key:component::valve::title%]"
}
}
}
}

0 comments on commit a1e3c75

Please sign in to comment.