mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Translated config flow form and steps (#4140)
* Translated config flow form and steps * Moved translation from config_entry to config_flow * Renamed translation key from not_all_fields_required to not_all_required_fields
This commit is contained in:
parent
274c2016c0
commit
c730aab28f
@ -122,7 +122,13 @@ export const showConfigFlowDialog = (
|
|||||||
<ha-markdown allowsvg .content=${description}></ha-markdown>
|
<ha-markdown allowsvg .content=${description}></ha-markdown>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
<p>Created config for ${step.title}.</p>
|
<p>
|
||||||
|
${hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.created_config",
|
||||||
|
"name",
|
||||||
|
step.title
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
`;
|
`;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -26,12 +26,20 @@ class StepFlowAbort extends LitElement {
|
|||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult | void {
|
||||||
return html`
|
return html`
|
||||||
<h2>Aborted</h2>
|
<h2>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.aborted"
|
||||||
|
)}
|
||||||
|
</h2>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
${this.flowConfig.renderAbortDescription(this.hass, this.step)}
|
${this.flowConfig.renderAbortDescription(this.hass, this.step)}
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<mwc-button @click="${this._flowDone}">Close</mwc-button>
|
<mwc-button @click="${this._flowDone}"
|
||||||
|
>${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.close"
|
||||||
|
)}</mwc-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,9 @@ class StepFlowCreateEntry extends LitElement {
|
|||||||
${device.model} (${device.manufacturer})
|
${device.model} (${device.manufacturer})
|
||||||
</div>
|
</div>
|
||||||
<paper-dropdown-menu-light
|
<paper-dropdown-menu-light
|
||||||
label="Area"
|
label="${localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.area_picker_label"
|
||||||
|
)}"
|
||||||
.device=${device.id}
|
.device=${device.id}
|
||||||
@selected-item-changed=${this._handleAreaChanged}
|
@selected-item-changed=${this._handleAreaChanged}
|
||||||
>
|
>
|
||||||
@ -91,11 +93,19 @@ class StepFlowCreateEntry extends LitElement {
|
|||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
${this.devices.length > 0
|
${this.devices.length > 0
|
||||||
? html`
|
? html`
|
||||||
<mwc-button @click="${this._addArea}">Add Area</mwc-button>
|
<mwc-button @click="${this._addArea}"
|
||||||
|
>${localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.add_area"
|
||||||
|
)}</mwc-button
|
||||||
|
>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
|
|
||||||
<mwc-button @click="${this._flowDone}">Finish</mwc-button>
|
<mwc-button @click="${this._flowDone}"
|
||||||
|
>${localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.finish"
|
||||||
|
)}</mwc-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -105,7 +115,11 @@ class StepFlowCreateEntry extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _addArea() {
|
private async _addArea() {
|
||||||
const name = prompt("Name of the new area?");
|
const name = prompt(
|
||||||
|
this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.name_new_area"
|
||||||
|
)
|
||||||
|
);
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -115,7 +129,11 @@ class StepFlowCreateEntry extends LitElement {
|
|||||||
});
|
});
|
||||||
this.areas = [...this.areas, area];
|
this.areas = [...this.areas, area];
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
alert("Failed to create area.");
|
alert(
|
||||||
|
this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.failed_create_area"
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +152,13 @@ class StepFlowCreateEntry extends LitElement {
|
|||||||
area_id: area,
|
area_id: area,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
alert(`Error saving area: ${err.message}`);
|
alert(
|
||||||
|
this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.error_saving_area",
|
||||||
|
"error",
|
||||||
|
"err.message"
|
||||||
|
)
|
||||||
|
);
|
||||||
dropdown.value = null;
|
dropdown.value = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,14 +87,17 @@ class StepFlowForm extends LitElement {
|
|||||||
<mwc-button
|
<mwc-button
|
||||||
@click=${this._submitStep}
|
@click=${this._submitStep}
|
||||||
.disabled=${!allRequiredInfoFilledIn}
|
.disabled=${!allRequiredInfoFilledIn}
|
||||||
>
|
>${this.hass.localize(
|
||||||
Submit
|
"ui.panel.config.integrations.config_flow.submit"
|
||||||
|
)}
|
||||||
</mwc-button>
|
</mwc-button>
|
||||||
|
|
||||||
${!allRequiredInfoFilledIn
|
${!allRequiredInfoFilledIn
|
||||||
? html`
|
? html`
|
||||||
<paper-tooltip position="left">
|
<paper-tooltip position="left"
|
||||||
Not all required fields are filled in.
|
>${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.not_all_required_fields"
|
||||||
|
)}
|
||||||
</paper-tooltip>
|
</paper-tooltip>
|
||||||
`
|
`
|
||||||
: html``}
|
: html``}
|
||||||
|
@ -1269,6 +1269,17 @@
|
|||||||
"no_area": "No Area"
|
"no_area": "No Area"
|
||||||
},
|
},
|
||||||
"config_flow": {
|
"config_flow": {
|
||||||
|
"aborted": "Aborted",
|
||||||
|
"close": "Close",
|
||||||
|
"finish": "Finish",
|
||||||
|
"submit": "Submit",
|
||||||
|
"not_all_required_fields": "Not all required fields are filled in.",
|
||||||
|
"add_area": "Add Area",
|
||||||
|
"area_picker_label": "Area",
|
||||||
|
"failed_create_area": "Failed to create area.",
|
||||||
|
"error_saving_area": "Error saving area: {error}",
|
||||||
|
"name_new_area": "Name of the new area?",
|
||||||
|
"created_config": "Created config for {name}.",
|
||||||
"external_step": {
|
"external_step": {
|
||||||
"description": "This step requires you to visit an external website to be completed.",
|
"description": "This step requires you to visit an external website to be completed.",
|
||||||
"open_site": "Open website"
|
"open_site": "Open website"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user