From 184575fd5497bc397d44942d05e588f58c859faa Mon Sep 17 00:00:00 2001 From: Sven <1040402+svendroid@users.noreply.github.com> Date: Thu, 3 Oct 2019 14:38:34 +0200 Subject: [PATCH] Add localization to persons config page (#3846) (#3871) --- .../config/person/dialog-person-detail.ts | 24 +++++++++++---- src/panels/config/person/ha-config-person.ts | 30 ++++++++++++------- src/translations/en.json | 15 +++++++++- 3 files changed, 52 insertions(+), 17 deletions(-) diff --git a/src/panels/config/person/dialog-person-detail.ts b/src/panels/config/person/dialog-person-detail.ts index 6a191e72a0..54d3af044b 100644 --- a/src/panels/config/person/dialog-person-detail.ts +++ b/src/panels/config/person/dialog-person-detail.ts @@ -55,7 +55,11 @@ class DialogPersonDetail extends LitElement { opened @opened-changed="${this._openedChanged}" > -

${this._params.entry ? this._params.entry.name : "New Person"}

+

+ ${this._params.entry + ? this._params.entry.name + : this.hass!.localize("ui.panel.config.person.detail.new_person")} +

${this._error ? html` @@ -66,12 +70,18 @@ class DialogPersonDetail extends LitElement { - DELETE + ${this.hass!.localize("ui.panel.config.person.detail.delete")} ` : html``} @@ -112,7 +122,9 @@ class DialogPersonDetail extends LitElement { @click="${this._updateEntry}" .disabled=${nameInvalid || this._submitting} > - ${this._params.entry ? "UPDATE" : "CREATE"} + ${this._params.entry + ? this.hass!.localize("ui.panel.config.person.detail.update") + : this.hass!.localize("ui.panel.config.person.detail.create")} diff --git a/src/panels/config/person/ha-config-person.ts b/src/panels/config/person/ha-config-person.ts index 94fe6c427c..46958c4fd6 100644 --- a/src/panels/config/person/ha-config-person.ts +++ b/src/panels/config/person/ha-config-person.ts @@ -55,17 +55,21 @@ class HaConfigPerson extends LitElement { `; } + const hass = this.hass; return html` - + - Persons + ${hass.localize("ui.panel.config.person.caption")} - Here you can define each person of interest in Home Assistant. + ${hass.localize("ui.panel.config.person.introduction")} ${this._configItems.length > 0 ? html`

- Note: persons configured via configuration.yaml cannot be - edited via the UI. + ${hass.localize( + "ui.panel.config.person.note_about_persons_configured_in_yaml" + )}

` : ""} @@ -83,9 +87,13 @@ class HaConfigPerson extends LitElement { ${this._storageItems.length === 0 ? html`
- Looks like you have not created any persons yet. + ${hass.localize( + "ui.panel.config.person.no_persons_created_yet" + )} - CREATE PERSON
` @@ -112,7 +120,7 @@ class HaConfigPerson extends LitElement { `; @@ -180,9 +188,11 @@ class HaConfigPerson extends LitElement { }, removeEntry: async () => { if ( - !confirm(`Are you sure you want to delete this person? + !confirm(`${this.hass!.localize( + "ui.panel.config.person.confirm_delete" + )} -All devices belonging to this person will become unassigned.`) +${this.hass!.localize("ui.panel.config.person.confirm_delete2")}`) ) { return false; } diff --git a/src/translations/en.json b/src/translations/en.json index bd919711b7..0e879b76d2 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -939,11 +939,24 @@ "person": { "caption": "Persons", "description": "Manage the persons that Home Assistant tracks.", + "introduction": "Here you can define each person of interest in Home Assistant.", + "note_about_persons_configured_in_yaml": "Note: persons configured via configuration.yaml cannot be edited via the UI.", + "no_persons_created_yet": "Looks like you have not created any persons yet.", + "create_person": "Create Person", + "add_person": "Add Person", + "confirm_delete": "Are you sure you want to delete this person?", + "confirm_delete2": "All devices belonging to this person will become unassigned.", "detail": { + "new_person": "New Person", "name": "Name", + "name_error_msg": "Name is required", + "linked_user": "Linked User", "device_tracker_intro": "Select the devices that belong to this person.", "device_tracker_picked": "Track Device", - "device_tracker_pick": "Pick device to track" + "device_tracker_pick": "Pick device to track", + "delete": "Delete", + "create": "Create", + "update": "Update" } }, "integrations": {