Translated unused entities, device registry page and domain toggler dialog (#4141)

* Translated device registry and domain toggler dialog

* Translated unused entities page

* Extracted unused_entities keys and created new section for domain_toggler

* Moved unknow_error and area_picker_label into devices section
This commit is contained in:
springstan 2019-11-01 16:07:18 +01:00 committed by Bram Kragten
parent 46f5224e70
commit 0fa8db1682
5 changed files with 52 additions and 18 deletions

View File

@ -74,7 +74,10 @@ class DialogDeviceRegistryDetail extends LitElement {
opened opened
@opened-changed="${this._openedChanged}" @opened-changed="${this._openedChanged}"
> >
<h2>${device.name || "Unnamed device"}</h2> <h2>
${device.name ||
this.hass.localize("ui.panel.config.devices.unnamed_device")}
</h2>
<paper-dialog-scrollable> <paper-dialog-scrollable>
${this._error ${this._error
? html` ? html`
@ -90,7 +93,12 @@ class DialogDeviceRegistryDetail extends LitElement {
.disabled=${this._submitting} .disabled=${this._submitting}
></paper-input> ></paper-input>
<div class="area"> <div class="area">
<paper-dropdown-menu label="Area" class="flex"> <paper-dropdown-menu
label="${this.hass.localize(
"ui.panel.config.devices.area_picker_label"
)}"
class="flex"
>
<paper-listbox <paper-listbox
slot="dropdown-content" slot="dropdown-content"
.selected="${this._computeSelectedArea()}" .selected="${this._computeSelectedArea()}"
@ -163,7 +171,9 @@ class DialogDeviceRegistryDetail extends LitElement {
}); });
this._params = undefined; this._params = undefined;
} catch (err) { } catch (err) {
this._error = err.message || "Unknown error"; this._error =
err.message ||
this.hass.localize("ui.panel.config.devices.unknown_error");
} finally { } finally {
this._submitting = false; this._submitting = false;
} }

View File

@ -37,7 +37,9 @@ class DomainTogglerDialog extends LitElement {
opened opened
@opened-changed=${this._openedChanged} @opened-changed=${this._openedChanged}
> >
<h2>Toggle Domains</h2> <h2>
${this.hass.localize("ui.dialogs.domain_toggler.title")}
</h2>
<div> <div>
${domains.map( ${domains.map(
(domain) => (domain) =>

View File

@ -57,7 +57,7 @@ export class HuiUnusedEntities extends LitElement {
private _columns = memoizeOne((narrow: boolean) => { private _columns = memoizeOne((narrow: boolean) => {
const columns: DataTableColumnContainer = { const columns: DataTableColumnContainer = {
entity: { entity: {
title: "Entity", title: this.hass!.localize("ui.panel.lovelace.unused_entities.entity"),
sortable: true, sortable: true,
filterable: true, filterable: true,
filterKey: "friendly_name", filterKey: "friendly_name",
@ -79,17 +79,19 @@ export class HuiUnusedEntities extends LitElement {
} }
columns.entity_id = { columns.entity_id = {
title: "Entity id", title: this.hass!.localize("ui.panel.lovelace.unused_entities.entity_id"),
sortable: true, sortable: true,
filterable: true, filterable: true,
}; };
columns.domain = { columns.domain = {
title: "Domain", title: this.hass!.localize("ui.panel.lovelace.unused_entities.domain"),
sortable: true, sortable: true,
filterable: true, filterable: true,
}; };
columns.last_changed = { columns.last_changed = {
title: "Last Changed", title: this.hass!.localize(
"ui.panel.lovelace.unused_entities.last_changed"
),
type: "numeric", type: "numeric",
sortable: true, sortable: true,
template: (lastChanged: string) => html` template: (lastChanged: string) => html`
@ -121,14 +123,20 @@ export class HuiUnusedEntities extends LitElement {
} }
return html` return html`
<ha-card header="Unused entities"> <ha-card
header="${this.hass.localize(
"ui.panel.lovelace.unused_entities.title"
)}"
>
<div class="card-content"> <div class="card-content">
These are the entities that you have available, but are not in your ${this.hass.localize(
Lovelace UI yet. "ui.panel.lovelace.unused_entities.available_entities"
)}
${this.lovelace.mode === "storage" ${this.lovelace.mode === "storage"
? html` ? html`
<br />Select the entities you want to add to a card and then <br />${this.hass.localize(
click the add card button. "ui.panel.lovelace.unused_entities.select_to_add"
)}
` `
: ""} : ""}
</div> </div>

View File

@ -142,12 +142,12 @@ class HUIRoot extends LitElement {
: html` : html`
<paper-item <paper-item
aria-label=${this.hass!.localize( aria-label=${this.hass!.localize(
"ui.panel.lovelace.menu.unused_entities" "ui.panel.lovelace.unused_entities.title"
)} )}
@tap="${this._handleUnusedEntities}" @tap="${this._handleUnusedEntities}"
> >
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.lovelace.menu.unused_entities" "ui.panel.lovelace.unused_entities.title"
)} )}
</paper-item> </paper-item>
`} `}
@ -203,12 +203,12 @@ class HUIRoot extends LitElement {
</paper-item> </paper-item>
<paper-item <paper-item
aria-label=${this.hass!.localize( aria-label=${this.hass!.localize(
"ui.panel.lovelace.menu.unused_entities" "ui.panel.lovelace.unused_entities.title"
)} )}
@tap="${this._handleUnusedEntities}" @tap="${this._handleUnusedEntities}"
> >
${this.hass!.localize( ${this.hass!.localize(
"ui.panel.lovelace.menu.unused_entities" "ui.panel.lovelace.unused_entities.title"
)} )}
</paper-item> </paper-item>
` `

View File

@ -618,6 +618,9 @@
"area_picker_label": "Area", "area_picker_label": "Area",
"update_name_button": "Update Name" "update_name_button": "Update Name"
} }
},
"domain_toggler": {
"title": "Toggle Domains"
} }
}, },
"duration": { "duration": {
@ -1141,6 +1144,9 @@
"devices": { "devices": {
"caption": "Devices", "caption": "Devices",
"description": "Manage connected devices", "description": "Manage connected devices",
"unnamed_device": "Unnamed device",
"unknown_error": "Unknown error",
"area_picker_label": "Area",
"automation": { "automation": {
"triggers": { "triggers": {
"caption": "Do something when..." "caption": "Do something when..."
@ -1408,13 +1414,21 @@
"more_info": "Show more-info: {name}" "more_info": "Show more-info: {name}"
} }
}, },
"unused_entities": {
"title": "Unused entities",
"available_entities": "These are the entities that you have available, but are not in your Lovelace UI yet.",
"select_to_add": "Select the entities you want to add to a card and then click the add card button.",
"entity": "Entity",
"entity_id": "Entity ID",
"domain": "Domain",
"last_changed": "Last Changed"
},
"views": { "views": {
"confirm_delete": "Are you sure you want to delete this view?", "confirm_delete": "Are you sure you want to delete this view?",
"existing_cards": "You can't delete a view that has cards in it. Remove the cards first." "existing_cards": "You can't delete a view that has cards in it. Remove the cards first."
}, },
"menu": { "menu": {
"configure_ui": "Configure UI", "configure_ui": "Configure UI",
"unused_entities": "Unused entities",
"help": "Help", "help": "Help",
"refresh": "Refresh", "refresh": "Refresh",
"close": "Close" "close": "Close"