Translated hui-editor and hui-root pages (#4142)

This commit is contained in:
springstan 2019-10-29 13:15:47 +01:00 committed by Bram Kragten
parent b41f4777d4
commit 6196bbdc5e
4 changed files with 54 additions and 12 deletions

View File

@ -74,7 +74,10 @@ class LovelacePanel extends LitElement {
if (state === "error") {
return html`
<hass-error-screen title="Lovelace" .error="${this._errorMsg}">
<hass-error-screen
title="${this.hass!.localize("domain.lovelace")}"
.error="${this._errorMsg}"
>
<mwc-button on-click="_forceFetchConfig"
>${this.hass!.localize(
"ui.panel.lovelace.reload_lovelace"

View File

@ -157,7 +157,11 @@ class LovelaceFullConfigEditor extends LitElement {
private _closeEditor() {
if (this._changed) {
if (
!confirm("You have unsaved changes, are you sure you want to exit?")
!confirm(
this.hass.localize(
"ui.panel.lovelace.editor.raw_editor.confirm_unsaved_changes"
)
)
) {
return;
}
@ -174,7 +178,9 @@ class LovelaceFullConfigEditor extends LitElement {
if (this.yamlEditor.hasComments) {
if (
!confirm(
"Your config contains comment(s), these will not be saved. Do you want to continue?"
this.hass.localize(
"ui.panel.lovelace.editor.raw_editor.confirm_unsaved_comments"
)
)
) {
return;
@ -185,20 +191,38 @@ class LovelaceFullConfigEditor extends LitElement {
try {
value = safeLoad(this.yamlEditor.value);
} catch (err) {
alert(`Unable to parse YAML: ${err}`);
alert(
this.hass.localize(
"ui.panel.lovelace.editor.raw_editor.error_parse_yaml",
"error",
err
)
);
this._saving = false;
return;
}
try {
value = lovelaceStruct(value);
} catch (err) {
alert(`Your config is not valid: ${err}`);
alert(
this.hass.localize(
"ui.panel.lovelace.editor.raw_editor.error_invalid_config",
"error",
err
)
);
return;
}
try {
await this.lovelace!.saveConfig(value);
} catch (err) {
alert(`Unable to save YAML: ${err}`);
alert(
this.hass.localize(
"ui.panel.lovelace.editor.raw_editor.error_save_yaml",
"error",
err
)
);
}
this._generation = this.yamlEditor
.codemirror!.getDoc()

View File

@ -107,7 +107,9 @@ class HUIRoot extends LitElement {
</div>
<paper-icon-button
icon="hass:help-circle"
title="Help"
title="${this.hass!.localize(
"ui.panel.lovelace.menu.help"
)}"
@click="${this._handleHelp}"
></paper-icon-button>
<paper-menu-button
@ -256,7 +258,9 @@ class HUIRoot extends LitElement {
${this._editMode
? html`
<ha-paper-icon-button-arrow-prev
title="Move view left"
title="${this.hass!.localize(
"ui.panel.lovelace.editor.edit_view.move_left"
)}"
class="edit-icon view"
@click="${this._moveViewLeft}"
?disabled="${this._curView === 0}"
@ -274,13 +278,17 @@ class HUIRoot extends LitElement {
${this._editMode
? html`
<ha-icon
title="Edit view"
title="${this.hass!.localize(
"ui.panel.lovelace.editor.edit_view.edit"
)}"
class="edit-icon view"
icon="hass:pencil"
@click="${this._editView}"
></ha-icon>
<ha-paper-icon-button-arrow-next
title="Move view right"
title="${this.hass!.localize(
"ui.panel.lovelace.editor.edit_view.move_right"
)}"
class="edit-icon view"
@click="${this._moveViewRight}"
?disabled="${(this._curView! as number) +

View File

@ -1423,7 +1423,12 @@
"header": "Edit Config",
"save": "Save",
"unsaved_changes": "Unsaved changes",
"saved": "Saved"
"saved": "Saved",
"confirm_unsaved_changes": "You have unsaved changes, are you sure you want to exit?",
"confirm_unsaved_comments": "Your config contains comment(s), these will not be saved. Do you want to continue?",
"error_parse_yaml": "Unable to parse YAML: {error}",
"error_invalid_config": "Your config is not valid: {error}",
"error_save_yaml": "Unable to save YAML: {error}"
},
"edit_lovelace": {
"header": "Title of your Lovelace UI",
@ -1435,7 +1440,9 @@
"header_name": "{name} View Configuration",
"add": "Add view",
"edit": "Edit view",
"delete": "Delete view"
"delete": "Delete view",
"move_left": "Move view left",
"move_right": "Move view right"
},
"edit_card": {
"header": "Card Configuration",