mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 08:46:35 +00:00
Translate select options in config flows (#25911)
This commit is contained in:
parent
af149dcfab
commit
93df473ad2
@ -24,12 +24,16 @@ export class HaFormSelect extends LitElement implements HaFormElement {
|
||||
|
||||
@property() public helper?: string;
|
||||
|
||||
@property({ attribute: false })
|
||||
public localizeValue?: (key: string) => string;
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
private _selectSchema = memoizeOne(
|
||||
(options): SelectSelector => ({
|
||||
(schema: HaFormSelectSchema): SelectSelector => ({
|
||||
select: {
|
||||
options: options.map((option) => ({
|
||||
translation_key: schema.name,
|
||||
options: schema.options.map((option) => ({
|
||||
value: option[0],
|
||||
label: option[1],
|
||||
})),
|
||||
@ -41,13 +45,13 @@ export class HaFormSelect extends LitElement implements HaFormElement {
|
||||
return html`
|
||||
<ha-selector-select
|
||||
.hass=${this.hass}
|
||||
.schema=${this.schema}
|
||||
.value=${this.data}
|
||||
.label=${this.label}
|
||||
.helper=${this.helper}
|
||||
.disabled=${this.disabled}
|
||||
.required=${this.schema.required}
|
||||
.selector=${this._selectSchema(this.schema.options)}
|
||||
.required=${this.schema.required || false}
|
||||
.selector=${this._selectSchema(this.schema)}
|
||||
.localizeValue=${this.localizeValue}
|
||||
@value-changed=${this._valueChanged}
|
||||
></ha-selector-select>
|
||||
`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user