Translated a bunch of strings (#4137)

* Translated customization page
 - added translation key-value pairs to en.json
 - translated form-customize, customize-icon and its key-value

* Translated mutliple pages:
 - devices
 - entity-registry
 - config-entry
 - dashboard -> hint to advanced mode toggle

* Translated custom panel confirm message

* Added translation for no entries in logbook

* Updated translation keys, tested and removed ha-types file translations

* Removed setting an if to true for testing

* Use template literal instead of string concatenation
This commit is contained in:
springstan 2019-11-01 16:12:49 +01:00 committed by Bram Kragten
parent 0fa8db1682
commit f53eea81c4
9 changed files with 119 additions and 39 deletions

View File

@ -3,13 +3,14 @@ import "@polymer/paper-item/paper-item";
import "@polymer/paper-listbox/paper-listbox"; import "@polymer/paper-listbox/paper-listbox";
import { html } from "@polymer/polymer/lib/utils/html-tag"; import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element"; import { PolymerElement } from "@polymer/polymer/polymer-element";
import LocalizeMixin from "../../../mixins/localize-mixin";
import hassAttributeUtil from "../../../util/hass-attributes-util"; import hassAttributeUtil from "../../../util/hass-attributes-util";
import "./ha-form-customize-attributes"; import "./ha-form-customize-attributes";
import { computeStateDomain } from "../../../common/entity/compute_state_domain"; import { computeStateDomain } from "../../../common/entity/compute_state_domain";
class HaFormCustomize extends PolymerElement { class HaFormCustomize extends LocalizeMixin(PolymerElement) {
static get template() { static get template() {
return html` return html`
<style include="iron-flex ha-style ha-form-style"> <style include="iron-flex ha-style ha-form-style">
@ -26,19 +27,18 @@ class HaFormCustomize extends PolymerElement {
if="[[computeShowWarning(localConfig, globalConfig)]]" if="[[computeShowWarning(localConfig, globalConfig)]]"
> >
<div class="warning"> <div class="warning">
It seems that your configuration.yaml doesn't properly [[localize('ui.panel.config.customize.warning.include_sentence')]]
<a <a
href="https://www.home-assistant.io/docs/configuration/customizing-devices/#customization-using-the-ui" href="https://www.home-assistant.io/docs/configuration/customizing-devices/#customization-using-the-ui"
target="_blank" target="_blank"
>include customize.yaml</a >[[localize('ui.panel.config.customize.warning.include_link')]]</a
>.<br /> >.<br />
Changes made here are written in it, but will not be applied after a [[localize('ui.panel.config.customize.warning.not_applied')]]
configuration reload unless the include is in place.
</div> </div>
</template> </template>
<template is="dom-if" if="[[hasLocalAttributes]]"> <template is="dom-if" if="[[hasLocalAttributes]]">
<h4 class="attributes-text"> <h4 class="attributes-text">
The following attributes are already set in customize.yaml<br /> [[localize('ui.panel.config.customize.attributes_customize')]]<br />
</h4> </h4>
<ha-form-customize-attributes <ha-form-customize-attributes
attributes="{{localAttributes}}" attributes="{{localAttributes}}"
@ -46,9 +46,8 @@ class HaFormCustomize extends PolymerElement {
</template> </template>
<template is="dom-if" if="[[hasGlobalAttributes]]"> <template is="dom-if" if="[[hasGlobalAttributes]]">
<h4 class="attributes-text"> <h4 class="attributes-text">
The following attributes are customized from outside of [[localize('ui.panel.config.customize.attributes_outside')]]<br />
customize.yaml<br /> [[localize('ui.panel.config.customize.different_include')]]
Possibly via a domain, a glob or a different include.
</h4> </h4>
<ha-form-customize-attributes <ha-form-customize-attributes
attributes="{{globalAttributes}}" attributes="{{globalAttributes}}"
@ -56,8 +55,8 @@ class HaFormCustomize extends PolymerElement {
</template> </template>
<template is="dom-if" if="[[hasExistingAttributes]]"> <template is="dom-if" if="[[hasExistingAttributes]]">
<h4 class="attributes-text"> <h4 class="attributes-text">
The following attributes of the entity are set programatically.<br /> [[localize('ui.panel.config.customize.attributes_set')]]<br />
You can override them if you like. [[localize('ui.panel.config.customize.attributes_override')]]
</h4> </h4>
<ha-form-customize-attributes <ha-form-customize-attributes
attributes="{{existingAttributes}}" attributes="{{existingAttributes}}"
@ -65,7 +64,7 @@ class HaFormCustomize extends PolymerElement {
</template> </template>
<template is="dom-if" if="[[hasNewAttributes]]"> <template is="dom-if" if="[[hasNewAttributes]]">
<h4 class="attributes-text"> <h4 class="attributes-text">
The following attributes weren't set. Set them if you like. [[localize('ui.panel.config.customize.attributes_not_set')]]
</h4> </h4>
<ha-form-customize-attributes <ha-form-customize-attributes
attributes="{{newAttributes}}" attributes="{{newAttributes}}"
@ -73,7 +72,7 @@ class HaFormCustomize extends PolymerElement {
</template> </template>
<div class="form-group"> <div class="form-group">
<paper-dropdown-menu <paper-dropdown-menu
label="Pick an attribute to override" label="[[localize('ui.panel.config.customize.pick_attribute')]]"
class="flex" class="flex"
dynamic-align="" dynamic-align=""
> >

View File

@ -124,7 +124,9 @@ class HaConfigDashboard extends NavigateMixin(LocalizeMixin(PolymerElement)) {
<template is='dom-if' if='[[!showAdvanced]]'> <template is='dom-if' if='[[!showAdvanced]]'>
<div class='promo-advanced'> <div class='promo-advanced'>
Missing config options? Enable advanced mode on <a href="/profile">your profile page.</a> [[localize('ui.panel.profile.advanced_mode.hint_enable')]] <a
href="/profile"
>[[localize('ui.panel.profile.advanced_mode.link_profile_page')]]</a>.
</div> </div>
</template> </template>
</ha-config-section> </ha-config-section>

View File

@ -122,7 +122,11 @@ export class HaConfigDevicePage extends LitElement {
if (!device) { if (!device) {
return html` return html`
<hass-error-screen error="Device not found."></hass-error-screen> <hass-error-screen
error="${this.hass.localize(
"ui.panel.config.devices.device_not_found"
)}"
></hass-error-screen>
`; `;
} }
@ -136,9 +140,11 @@ export class HaConfigDevicePage extends LitElement {
@click=${this._showSettings} @click=${this._showSettings}
></paper-icon-button> ></paper-icon-button>
<ha-config-section .isWide=${!this.narrow}> <ha-config-section .isWide=${!this.narrow}>
<span slot="header">Device info</span> <span slot="header"
>${this.hass.localize("ui.panel.config.devices.info")}</span
>
<span slot="introduction"> <span slot="introduction">
Here are all the details of your device. ${this.hass.localize("ui.panel.config.devices.details")}
</span> </span>
<ha-device-card <ha-device-card
.hass=${this.hass} .hass=${this.hass}
@ -149,7 +155,9 @@ export class HaConfigDevicePage extends LitElement {
${entities.length ${entities.length
? html` ? html`
<div class="header">Entities</div> <div class="header">
${this.hass.localize("ui.panel.config.devices.entities")}
</div>
<ha-device-entities-card <ha-device-entities-card
.hass=${this.hass} .hass=${this.hass}
.entities=${entities} .entities=${entities}
@ -161,7 +169,9 @@ export class HaConfigDevicePage extends LitElement {
this._conditions.length || this._conditions.length ||
this._actions.length this._actions.length
? html` ? html`
<div class="header">Automations</div> <div class="header">
${this.hass.localize("ui.panel.config.devices.automations")}
</div>
${this._triggers.length ${this._triggers.length
? html` ? html`
<ha-device-triggers-card <ha-device-triggers-card
@ -222,7 +232,9 @@ export class HaConfigDevicePage extends LitElement {
const renameEntityid = const renameEntityid =
this.showAdvanced && this.showAdvanced &&
confirm( confirm(
"Do you also want to rename the entity id's of your entities?" this.hass.localize(
"ui.panel.config.devices.confirm_rename_entity_ids"
)
); );
const updateProms = entities.map((entity) => { const updateProms = entities.map((entity) => {

View File

@ -159,33 +159,45 @@ export class HaDevicesDataTable extends LitElement {
} }
: { : {
name: { name: {
title: "Device", title: this.hass.localize(
"ui.panel.config.devices.data_table.device"
),
sortable: true, sortable: true,
filterable: true, filterable: true,
direction: "asc", direction: "asc",
}, },
manufacturer: { manufacturer: {
title: "Manufacturer", title: this.hass.localize(
"ui.panel.config.devices.data_table.manufacturer"
),
sortable: true, sortable: true,
filterable: true, filterable: true,
}, },
model: { model: {
title: "Model", title: this.hass.localize(
"ui.panel.config.devices.data_table.model"
),
sortable: true, sortable: true,
filterable: true, filterable: true,
}, },
area: { area: {
title: "Area", title: this.hass.localize(
"ui.panel.config.devices.data_table.area"
),
sortable: true, sortable: true,
filterable: true, filterable: true,
}, },
integration: { integration: {
title: "Integration", title: this.hass.localize(
"ui.panel.config.devices.data_table.integration"
),
sortable: true, sortable: true,
filterable: true, filterable: true,
}, },
battery_entity: { battery_entity: {
title: "Battery", title: this.hass.localize(
"ui.panel.config.devices.data_table.battery"
),
sortable: true, sortable: true,
type: "numeric", type: "numeric",
template: (batteryEntity: string) => { template: (batteryEntity: string) => {

View File

@ -130,7 +130,9 @@ class DialogEntityRegistryDetail extends LitElement {
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.entity_registry.editor.enabled_description" "ui.panel.config.entity_registry.editor.enabled_description"
)} )}
<br />Note: this might not work yet with all integrations. <br />${this.hass.localize(
"ui.panel.config.entity_registry.editor.note"
)}
</div> </div>
</div> </div>
</ha-switch> </ha-switch>

View File

@ -63,7 +63,11 @@ class HaConfigEntryPage extends LitElement {
if (!configEntry) { if (!configEntry) {
return html` return html`
<hass-error-screen error="Integration not found."></hass-error-screen> <hass-error-screen
error="${this.hass.localize(
"ui.panel.config.integrations.integration_not_found"
)}"
></hass-error-screen>
`; `;
} }

View File

@ -78,13 +78,23 @@ export class HaPanelCustom extends UpdatingElement {
!["localhost", "127.0.0.1", location.hostname].includes(tempA.hostname) !["localhost", "127.0.0.1", location.hostname].includes(tempA.hostname)
) { ) {
if ( if (
!confirm(`Do you trust the external panel "${config.name}" at "${ !confirm(
tempA.href `${this.hass.localize(
}"? "ui.panel.custom.external_panel.question_trust",
"name",
config.name,
"link",
tempA.href
)}
It will have access to all data in Home Assistant. ${this.hass.localize(
"ui.panel.custom.external_panel.complete_access"
)}
(Check docs for the panel_custom component to hide this message)`) (${this.hass.localize(
"ui.panel.custom.external_panel.hide_message"
)})`
)
) { ) {
return; return;
} }

View File

@ -6,13 +6,14 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
import formatTime from "../../common/datetime/format_time"; import formatTime from "../../common/datetime/format_time";
import formatDate from "../../common/datetime/format_date"; import formatDate from "../../common/datetime/format_date";
import { EventsMixin } from "../../mixins/events-mixin"; import { EventsMixin } from "../../mixins/events-mixin";
import LocalizeMixin from "../../mixins/localize-mixin";
import { domainIcon } from "../../common/entity/domain_icon"; import { domainIcon } from "../../common/entity/domain_icon";
import { computeRTL } from "../../common/util/compute_rtl"; import { computeRTL } from "../../common/util/compute_rtl";
/* /*
* @appliesMixin EventsMixin * @appliesMixin EventsMixin
*/ */
class HaLogbook extends EventsMixin(PolymerElement) { class HaLogbook extends LocalizeMixin(EventsMixin(PolymerElement)) {
static get template() { static get template() {
return html` return html`
<style include="iron-flex"></style> <style include="iron-flex"></style>
@ -55,7 +56,7 @@ class HaLogbook extends EventsMixin(PolymerElement) {
</style> </style>
<template is="dom-if" if="[[!entries.length]]"> <template is="dom-if" if="[[!entries.length]]">
No logbook entries found. [[localize('ui.panel.logbook.entries_not_found')]]
</template> </template>
<template is="dom-repeat" items="[[entries]]"> <template is="dom-repeat" items="[[entries]]">

View File

@ -737,7 +737,19 @@
"picker": { "picker": {
"header": "Customization", "header": "Customization",
"introduction": "Tweak per-entity attributes. Added/edited customizations will take effect immediately. Removed customizations will take effect when the entity is updated." "introduction": "Tweak per-entity attributes. Added/edited customizations will take effect immediately. Removed customizations will take effect when the entity is updated."
} },
"warning": {
"include_sentence": "It seems that your configuration.yaml doesn't properly",
"include_link": "include customize.yaml",
"not_applied": "Changes made here are written in it, but will not be applied after a configuration reload unless the include is in place."
},
"attributes_customize": "The following attributes are already set in customize.yaml",
"attributes_outside": "The following attributes are customized from outside of customize.yaml",
"different_include": "Possibly via a domain, a glob or a different include.",
"attributes_set": "The following attributes of the entity are set programmatically.",
"attributes_override": "You can override them if you like.",
"attributes_not_set": "The following attributes weren't set. Set them if you like.",
"pick_attribute": "Pick an attribute to override"
}, },
"automation": { "automation": {
"caption": "Automation", "caption": "Automation",
@ -1157,6 +1169,20 @@
"actions": { "actions": {
"caption": "When something is triggered..." "caption": "When something is triggered..."
} }
},
"device_not_found": "Device not found.",
"info": "Device info",
"details": "Here are all the details of your device.",
"entities": "Entities",
"automations": "Automations",
"confirm_rename_entity_ids": "Do you also want to rename the entity id's of your entities?",
"data_table": {
"device": "Device",
"manufacturer": "Manufacturer",
"model": "Model",
"area": "Area",
"integration": "Integration",
"battery": "Battery"
} }
}, },
"entity_registry": { "entity_registry": {
@ -1184,7 +1210,8 @@
"delete": "DELETE", "delete": "DELETE",
"confirm_delete": "Are you sure you want to delete this entry?", "confirm_delete": "Are you sure you want to delete this entry?",
"confirm_delete2": "Deleting an entry will not remove the entity from Home Assistant. To do this, you will need to remove the integration '{platform}' from Home Assistant.", "confirm_delete2": "Deleting an entry will not remove the entity from Home Assistant. To do this, you will need to remove the integration '{platform}' from Home Assistant.",
"update": "UPDATE" "update": "UPDATE",
"note": "Note: this might not work yet with all integrations."
} }
}, },
"person": { "person": {
@ -1224,6 +1251,7 @@
"home_assistant_website": "Home Assistant website", "home_assistant_website": "Home Assistant website",
"configure": "Configure", "configure": "Configure",
"none": "Nothing configured yet", "none": "Nothing configured yet",
"integration_not_found": "Integration not found.",
"config_entry": { "config_entry": {
"settings_button": "Edit settings for {integration}", "settings_button": "Edit settings for {integration}",
"system_options_button": "System options for {integration}", "system_options_button": "System options for {integration}",
@ -1389,7 +1417,8 @@
}, },
"logbook": { "logbook": {
"showing_entries": "[%key:ui::panel::history::showing_entries%]", "showing_entries": "[%key:ui::panel::history::showing_entries%]",
"period": "Period" "period": "Period",
"entries_not_found": "No logbook entries found."
}, },
"lovelace": { "lovelace": {
"cards": { "cards": {
@ -1686,7 +1715,9 @@
}, },
"advanced_mode": { "advanced_mode": {
"title": "Advanced Mode", "title": "Advanced Mode",
"description": "Home Assistant hides advanced features and options by default. You can make these features accessible by checking this toggle. This is a user-specific setting and does not impact other users using Home Assistant." "description": "Home Assistant hides advanced features and options by default. You can make these features accessible by checking this toggle. This is a user-specific setting and does not impact other users using Home Assistant.",
"hint_enable": "Missing config options? Enable advanced mode on",
"link_profile_page": "your profile page"
}, },
"refresh_tokens": { "refresh_tokens": {
"header": "Refresh Tokens", "header": "Refresh Tokens",
@ -1995,6 +2026,13 @@
"more_integrations": "More", "more_integrations": "More",
"finish": "Finish" "finish": "Finish"
} }
},
"custom": {
"external_panel": {
"question_trust": "Do you trust the external panel {name} at {link}?",
"complete_access": "It will have access to all data in Home Assistant.",
"hide_message": "Check docs for the panel_custom component to hide this message"
}
} }
} }
} }