From 1afb8f109e97e2a5b832cb04a4ec467624c637b9 Mon Sep 17 00:00:00 2001
From: yosilevy <37745463+yosilevy@users.noreply.github.com>
Date: Tue, 19 Feb 2019 20:04:33 +0200
Subject: [PATCH] Localization updates (#2767)
* Label localization
* Added various missing localization labels + paper-fab RTL location fix (was totally gone behind app-drawer)
* Removed ha-markdown from all translations. Refactored links to separate anchors.
---
.../area_registry/ha-config-area-registry.ts | 39 +++++++++++++++----
.../config/automation/ha-automation-editor.ts | 14 +++++++
.../config/automation/ha-automation-picker.js | 36 +++++++++++++----
.../ha-config-entity-registry.ts | 22 +++++++----
src/panels/config/js/automation.js | 28 ++++++++-----
src/panels/config/script/ha-script-editor.js | 24 ++++++++++++
src/panels/config/script/ha-script-picker.js | 24 ++++++++++++
.../config/users/ha-config-user-picker.js | 23 +++++++++++
src/panels/config/users/ha-dialog-add-user.js | 12 +++---
src/panels/config/users/ha-user-editor.js | 4 +-
src/panels/lovelace/hui-view.ts | 12 ++++++
src/translations/en.json | 22 ++++++++---
12 files changed, 215 insertions(+), 45 deletions(-)
diff --git a/src/panels/config/area_registry/ha-config-area-registry.ts b/src/panels/config/area_registry/ha-config-area-registry.ts
index dbca7d6ba9..76cb01757b 100644
--- a/src/panels/config/area_registry/ha-config-area-registry.ts
+++ b/src/panels/config/area_registry/ha-config-area-registry.ts
@@ -27,6 +27,8 @@ import {
showAreaRegistryDetailDialog,
loadAreaRegistryDetailDialog,
} from "./show-dialog-area-registry-detail";
+import { classMap } from "lit-html/directives/class-map";
+import { computeRTL } from "../../../common/util/compute_rtl";
class HaConfigAreaRegistry extends LitElement {
public hass?: HomeAssistant;
@@ -48,20 +50,25 @@ class HaConfigAreaRegistry extends LitElement {
`;
}
return html`
-
+
${this.hass.localize("ui.panel.config.area_registry.picker.header")}
- Areas are used to organize where devices are. This information will
- be used throughout Home Assistant to help you in organizing your
- interface, permissions and integrations with other systems.
+ ${this.hass.localize(
+ "ui.panel.config.area_registry.picker.introduction"
+ )}
- To place devices in an area, navigate to
- the integrations page and then
- click on a configured integration to get to the device cards.
+ ${this.hass.localize(
+ "ui.panel.config.area_registry.picker.introduction2"
+ )}
+
${this._items.map((entry) => {
@@ -94,8 +101,13 @@ class HaConfigAreaRegistry extends LitElement {
`;
}
@@ -188,6 +200,17 @@ All devices in this area will become unassigned.`)
bottom: 24px;
right: 24px;
}
+
+ paper-fab.rtl {
+ right: auto;
+ left: 16px;
+ }
+
+ paper-fab[is-wide].rtl {
+ bottom: 24px;
+ right: auto;
+ left: 24px;
+ }
`;
}
}
diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts
index 65abc4bcda..93d1ab71ce 100644
--- a/src/panels/config/automation/ha-automation-editor.ts
+++ b/src/panels/config/automation/ha-automation-editor.ts
@@ -110,6 +110,9 @@ class HaAutomationEditor extends LitElement {
"ui.panel.config.automation.editor.save"
)}"
@click=${this._saveAutomation}
+ class="${classMap({
+ rtl: computeRTL(this.hass),
+ })}"
>
`;
@@ -280,6 +283,17 @@ class HaAutomationEditor extends LitElement {
paper-fab[dirty] {
margin-bottom: 0;
}
+
+ paper-fab.rtl {
+ right: auto;
+ left: 16px;
+ }
+
+ paper-fab[is-wide].rtl {
+ bottom: 24px;
+ right: auto;
+ left: 24px;
+ }
`,
];
}
diff --git a/src/panels/config/automation/ha-automation-picker.js b/src/panels/config/automation/ha-automation-picker.js
index d2dcbff6a3..f7cb80df7f 100644
--- a/src/panels/config/automation/ha-automation-picker.js
+++ b/src/panels/config/automation/ha-automation-picker.js
@@ -8,7 +8,6 @@ import "@polymer/paper-item/paper-item";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
-import "../../../components/ha-markdown";
import "../../../layouts/ha-app-layout";
import "../ha-config-section";
@@ -16,6 +15,8 @@ import "../ha-config-section";
import NavigateMixin from "../../../mixins/navigate-mixin";
import LocalizeMixin from "../../../mixins/localize-mixin";
import computeStateName from "../../../common/entity/compute_state_name";
+import { computeRTL } from "../../../common/util/compute_rtl";
+
/*
* @appliesMixin LocalizeMixin
* @appliesMixin NavigateMixin
@@ -44,12 +45,19 @@ class HaAutomationPicker extends LocalizeMixin(NavigateMixin(PolymerElement)) {
right: 24px;
}
- a {
- color: var(--primary-color);
+ paper-fab[rtl] {
+ right: auto;
+ left: 16px;
}
- ha-markdown p {
- margin: 0px;
+ paper-fab[rtl][is-wide] {
+ bottom: 24px;
+ right: auto;
+ left: 24px;
+ }
+
+ a {
+ color: var(--primary-color);
}
@@ -71,9 +79,10 @@ class HaAutomationPicker extends LocalizeMixin(NavigateMixin(PolymerElement)) {
[[localize('ui.panel.config.automation.picker.header')]]
-
+ [[localize('ui.panel.config.automation.picker.introduction')]]
+
`;
@@ -131,6 +141,12 @@ class HaAutomationPicker extends LocalizeMixin(NavigateMixin(PolymerElement)) {
isWide: {
type: Boolean,
},
+
+ rtl: {
+ type: Boolean,
+ reflectToAttribute: true,
+ computed: "_computeRTL(hass)",
+ },
};
}
@@ -158,6 +174,10 @@ class HaAutomationPicker extends LocalizeMixin(NavigateMixin(PolymerElement)) {
_backTapped() {
history.back();
}
+
+ _computeRTL(hass) {
+ return computeRTL(hass);
+ }
}
customElements.define("ha-automation-picker", HaAutomationPicker);
diff --git a/src/panels/config/entity_registry/ha-config-entity-registry.ts b/src/panels/config/entity_registry/ha-config-entity-registry.ts
index fb32443e3f..016f03e995 100644
--- a/src/panels/config/entity_registry/ha-config-entity-registry.ts
+++ b/src/panels/config/entity_registry/ha-config-entity-registry.ts
@@ -51,7 +51,11 @@ class HaConfigEntityRegistry extends LitElement {
`;
}
return html`
-
+
${this.hass.localize(
@@ -59,14 +63,16 @@ class HaConfigEntityRegistry extends LitElement {
)}
- Home Assistant keeps a registry of every entity it has ever seen
- that can be uniquely identified. Each of these entities will have an
- entity ID assigned which will be reserved for just this entity.
+ ${this.hass.localize(
+ "ui.panel.config.entity_registry.picker.introduction"
+ )}
- Use the entity registry to override the name, change the entity ID
- or remove the entry from Home Assistant. Note, removing the entity
- registry entry won't remove the entity. To do that, remove it from
- the integrations page.
+ ${this.hass.localize(
+ "ui.panel.config.entity_registry.picker.introduction2"
+ )}
+
diff --git a/src/panels/config/js/automation.js b/src/panels/config/js/automation.js
index 4c16a8cf52..5c7304c8f6 100644
--- a/src/panels/config/js/automation.js
+++ b/src/panels/config/js/automation.js
@@ -3,7 +3,6 @@ import { h, Component } from "preact";
import "@polymer/paper-card/paper-card";
import "@polymer/paper-input/paper-input";
import "../ha-config-section";
-import "../../../components/ha-markdown";
import Trigger from "./trigger/index";
import Condition from "./condition/index";
@@ -68,11 +67,14 @@ export default class Automation extends Component {
{localize("ui.panel.config.automation.editor.triggers.header")}
-
+ {localize(
"ui.panel.config.automation.editor.triggers.introduction"
)}
- />
+
+
+
+
-
+ {localize(
"ui.panel.config.automation.editor.conditions.introduction"
)}
- />
+
+
+
+
-
+ {localize(
"ui.panel.config.automation.editor.actions.introduction"
)}
- />
+
+
+
+