mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +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() public helper?: string;
|
||||||
|
|
||||||
|
@property({ attribute: false })
|
||||||
|
public localizeValue?: (key: string) => string;
|
||||||
|
|
||||||
@property({ type: Boolean }) public disabled = false;
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
private _selectSchema = memoizeOne(
|
private _selectSchema = memoizeOne(
|
||||||
(options): SelectSelector => ({
|
(schema: HaFormSelectSchema): SelectSelector => ({
|
||||||
select: {
|
select: {
|
||||||
options: options.map((option) => ({
|
translation_key: schema.name,
|
||||||
|
options: schema.options.map((option) => ({
|
||||||
value: option[0],
|
value: option[0],
|
||||||
label: option[1],
|
label: option[1],
|
||||||
})),
|
})),
|
||||||
@ -41,13 +45,13 @@ export class HaFormSelect extends LitElement implements HaFormElement {
|
|||||||
return html`
|
return html`
|
||||||
<ha-selector-select
|
<ha-selector-select
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.schema=${this.schema}
|
|
||||||
.value=${this.data}
|
.value=${this.data}
|
||||||
.label=${this.label}
|
.label=${this.label}
|
||||||
.helper=${this.helper}
|
.helper=${this.helper}
|
||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.required=${this.schema.required}
|
.required=${this.schema.required || false}
|
||||||
.selector=${this._selectSchema(this.schema.options)}
|
.selector=${this._selectSchema(this.schema)}
|
||||||
|
.localizeValue=${this.localizeValue}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-selector-select>
|
></ha-selector-select>
|
||||||
`;
|
`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user