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

View File

@ -124,7 +124,9 @@ class HaConfigDashboard extends NavigateMixin(LocalizeMixin(PolymerElement)) {
<template is='dom-if' if='[[!showAdvanced]]'>
<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>
</template>
</ha-config-section>

View File

@ -122,7 +122,11 @@ export class HaConfigDevicePage extends LitElement {
if (!device) {
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}
></paper-icon-button>
<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">
Here are all the details of your device.
${this.hass.localize("ui.panel.config.devices.details")}
</span>
<ha-device-card
.hass=${this.hass}
@ -149,7 +155,9 @@ export class HaConfigDevicePage extends LitElement {
${entities.length
? html`
<div class="header">Entities</div>
<div class="header">
${this.hass.localize("ui.panel.config.devices.entities")}
</div>
<ha-device-entities-card
.hass=${this.hass}
.entities=${entities}
@ -161,7 +169,9 @@ export class HaConfigDevicePage extends LitElement {
this._conditions.length ||
this._actions.length
? html`
<div class="header">Automations</div>
<div class="header">
${this.hass.localize("ui.panel.config.devices.automations")}
</div>
${this._triggers.length
? html`
<ha-device-triggers-card
@ -222,7 +232,9 @@ export class HaConfigDevicePage extends LitElement {
const renameEntityid =
this.showAdvanced &&
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) => {

View File

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

View File

@ -130,7 +130,9 @@ class DialogEntityRegistryDetail extends LitElement {
${this.hass.localize(
"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>
</ha-switch>

View File

@ -63,7 +63,11 @@ class HaConfigEntryPage extends LitElement {
if (!configEntry) {
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)
) {
if (
!confirm(`Do you trust the external panel "${config.name}" at "${
tempA.href
}"?
!confirm(
`${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;
}

View File

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

View File

@ -737,7 +737,19 @@
"picker": {
"header": "Customization",
"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": {
"caption": "Automation",
@ -1157,6 +1169,20 @@
"actions": {
"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": {
@ -1184,7 +1210,8 @@
"delete": "DELETE",
"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.",
"update": "UPDATE"
"update": "UPDATE",
"note": "Note: this might not work yet with all integrations."
}
},
"person": {
@ -1224,6 +1251,7 @@
"home_assistant_website": "Home Assistant website",
"configure": "Configure",
"none": "Nothing configured yet",
"integration_not_found": "Integration not found.",
"config_entry": {
"settings_button": "Edit settings for {integration}",
"system_options_button": "System options for {integration}",
@ -1389,7 +1417,8 @@
},
"logbook": {
"showing_entries": "[%key:ui::panel::history::showing_entries%]",
"period": "Period"
"period": "Period",
"entries_not_found": "No logbook entries found."
},
"lovelace": {
"cards": {
@ -1686,7 +1715,9 @@
},
"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": {
"header": "Refresh Tokens",
@ -1995,6 +2026,13 @@
"more_integrations": "More",
"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"
}
}
}
}