Translated automation and script editor (#4146)

This commit is contained in:
springstan 2019-10-29 13:12:35 +01:00 committed by Bram Kragten
parent 04500bc237
commit f2812bc706
6 changed files with 57 additions and 20 deletions

View File

@ -82,6 +82,9 @@ export class HaAutomationEditor extends LitElement {
? "" ? ""
: html` : html`
<paper-icon-button <paper-icon-button
title="${this.hass.localize(
"ui.panel.config.automation.picker.delete_automation"
)}"
icon="hass:delete" icon="hass:delete"
@click=${this._delete} @click=${this._delete}
></paper-icon-button> ></paper-icon-button>
@ -218,7 +221,11 @@ export class HaAutomationEditor extends LitElement {
} }
private async _delete() { private async _delete() {
if (!confirm("Are you sure you want to delete this automation?")) { if (
!confirm(
this.hass.localize("ui.panel.config.automation.picker.delete_confirm")
)
) {
return; return;
} }
await deleteAutomation(this.hass, this.automation.attributes.id!); await deleteAutomation(this.hass, this.automation.attributes.id!);

View File

@ -85,15 +85,15 @@ class HaAutomationPicker extends LitElement {
<paper-item-body two-line> <paper-item-body two-line>
<div>${computeStateName(automation)}</div> <div>${computeStateName(automation)}</div>
<div secondary> <div secondary>
Last triggered: ${ ${this.hass.localize(
"ui.card.automation.last_triggered"
)}: ${
automation.attributes.last_triggered automation.attributes.last_triggered
? format_date_time( ? format_date_time(
new Date( new Date(automation.attributes.last_triggered),
automation.attributes.last_triggered
),
this.hass.language this.hass.language
) )
: "never" : this.hass.localize("ui.components.relative_time.never")
} }
</div> </div>
</paper-item-body> </paper-item-body>
@ -102,6 +102,9 @@ class HaAutomationPicker extends LitElement {
.automation=${automation} .automation=${automation}
@click=${this._showInfo} @click=${this._showInfo}
icon="hass:information-outline" icon="hass:information-outline"
title="${this.hass.localize(
"ui.panel.config.automation.picker.show_info_automation"
)}"
></paper-icon-button> ></paper-icon-button>
<a <a
href=${ifDefined( href=${ifDefined(
@ -113,6 +116,9 @@ class HaAutomationPicker extends LitElement {
)} )}
> >
<paper-icon-button <paper-icon-button
title="${this.hass.localize(
"ui.panel.config.automation.picker.edit_automation"
)}"
icon="hass:pencil" icon="hass:pencil"
.disabled=${!automation.attributes.id} .disabled=${!automation.attributes.id}
></paper-icon-button> ></paper-icon-button>
@ -120,8 +126,9 @@ class HaAutomationPicker extends LitElement {
!automation.attributes.id !automation.attributes.id
? html` ? html`
<paper-tooltip position="left"> <paper-tooltip position="left">
Only automations defined in ${this.hass.localize(
automations.yaml are editable. "ui.panel.config.automation.picker.only_editable"
)}
</paper-tooltip> </paper-tooltip>
` `
: "" : ""

View File

@ -40,7 +40,7 @@ export default class ScriptEditor extends Component<{
<ha-config-section is-wide={isWide}> <ha-config-section is-wide={isWide}>
<span slot="header">{alias}</span> <span slot="header">{alias}</span>
<span slot="introduction"> <span slot="introduction">
Use scripts to execute a sequence of actions. {localize("ui.panel.config.script.editor.introduction")}
</span> </span>
<ha-card> <ha-card>
<div class="card-content"> <div class="card-content">
@ -55,12 +55,16 @@ export default class ScriptEditor extends Component<{
</ha-config-section> </ha-config-section>
<ha-config-section is-wide={isWide}> <ha-config-section is-wide={isWide}>
<span slot="header">Sequence</span> <span slot="header">
{localize("ui.panel.config.script.editor.sequence")}
</span>
<span slot="introduction"> <span slot="introduction">
The sequence of actions of this script. {localize("ui.panel.config.script.editor.sequence_sentence")}
<p> <p>
<a href="https://home-assistant.io/docs/scripts/" target="_blank"> <a href="https://home-assistant.io/docs/scripts/" target="_blank">
Learn more about available actions. {localize(
"ui.panel.config.script.editor.link_available_actions"
)}
</a> </a>
</p> </p>
</span> </span>

View File

@ -104,6 +104,7 @@ class HaScriptEditor extends LocalizeMixin(NavigateMixin(PolymerElement)) {
<template is="dom-if" if="[[!creatingNew]]"> <template is="dom-if" if="[[!creatingNew]]">
<paper-icon-button <paper-icon-button
icon="hass:delete" icon="hass:delete"
title="[[localize('ui.panel.config.script.editor.delete_script')]]"
on-click="_delete" on-click="_delete"
></paper-icon-button> ></paper-icon-button>
</template> </template>

View File

@ -72,6 +72,9 @@ class HaScriptPicker extends LitElement {
<paper-icon-button <paper-icon-button
.script=${script} .script=${script}
icon="hass:play" icon="hass:play"
title="${this.hass.localize(
"ui.panel.config.script.picker.trigger_script"
)}"
@click=${this._runScript} @click=${this._runScript}
></paper-icon-button> ></paper-icon-button>
<paper-item-body> <paper-item-body>
@ -81,6 +84,9 @@ class HaScriptPicker extends LitElement {
<a href=${`/config/script/edit/${script.entity_id}`}> <a href=${`/config/script/edit/${script.entity_id}`}>
<paper-icon-button <paper-icon-button
icon="hass:pencil" icon="hass:pencil"
title="${this.hass.localize(
"ui.panel.config.script.picker.edit_script"
)}"
></paper-icon-button> ></paper-icon-button>
</a> </a>
</div> </div>

View File

@ -739,7 +739,12 @@
"learn_more": "Learn more about automations", "learn_more": "Learn more about automations",
"pick_automation": "Pick automation to edit", "pick_automation": "Pick automation to edit",
"no_automations": "We couldnt find any editable automations", "no_automations": "We couldnt find any editable automations",
"add_automation": "Add automation" "add_automation": "Add automation",
"only_editable": "Only automations defined in automations.yaml are editable.",
"edit_automation": "Edit automation",
"show_info_automation": "Show info about automation",
"delete_automation": "Delete automation",
"delete_confirm": "Are you sure you want to delete this automation?"
}, },
"editor": { "editor": {
"introduction": "Use automations to bring your home alive.", "introduction": "Use automations to bring your home alive.",
@ -956,13 +961,20 @@
"introduction": "The script editor allows you to create and edit scripts. Please follow the link below to read the instructions to make sure that you have configured Home Assistant correctly.", "introduction": "The script editor allows you to create and edit scripts. Please follow the link below to read the instructions to make sure that you have configured Home Assistant correctly.",
"learn_more": "Learn more about scripts", "learn_more": "Learn more about scripts",
"no_scripts": "We couldnt find any editable scripts", "no_scripts": "We couldnt find any editable scripts",
"add_script": "Add script" "add_script": "Add script",
"trigger_script": "Trigger script",
"edit_script": "Edit script"
}, },
"editor": { "editor": {
"introduction": "Use scripts to execute a sequence of actions.",
"header": "Script: {name}", "header": "Script: {name}",
"default_name": "New Script", "default_name": "New Script",
"load_error_not_editable": "Only scripts inside scripts.yaml are editable.", "load_error_not_editable": "Only scripts inside scripts.yaml are editable.",
"delete_confirm": "Are you sure you want to delete this script?" "delete_confirm": "Are you sure you want to delete this script?",
"delete_script": "Delete script",
"sequence": "Sequence",
"sequence_sentence": "The sequence of actions of this script.",
"link_available_actions": "Learn more about available actions."
} }
}, },
"cloud": { "cloud": {