mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-14 05:20:31 +00:00
Make script editor translatable (#3866)
* Make script editor's script picker translatable (home-assistant/home-assistant-polymer#3848) * Make script editor translatable (home-assistant/home-assistant-polymer#3848) * Fix linting errors (home-assistant/home-assistant-polymer#3866) * Fix linting errors (home-assistant/home-assistant-polymer#3866) * Move unsaved_confirm translation key to common section (home-assistant/home-assistant-polymer#3866) Instead of adding the same text multiple times for every section, add a common section to indicate reusable translations. * Add variable to localization text * Use JavaScript instead of Polymer data binding
This commit is contained in:
committed by
Bram Kragten
parent
184575fd54
commit
56bac8a8c1
@@ -38,22 +38,36 @@ class HaScriptPicker extends LitElement {
|
||||
.header=${this.hass.localize("ui.panel.config.script.caption")}
|
||||
>
|
||||
<ha-config-section .isWide=${this.isWide}>
|
||||
<div slot="header">Script Editor</div>
|
||||
<div slot="header">
|
||||
${this.hass.localize("ui.panel.config.script.picker.header")}
|
||||
</div>
|
||||
<div slot="introduction">
|
||||
The script editor allows you to create and edit scripts. Please read
|
||||
<a
|
||||
href="https://home-assistant.io/docs/scripts/editor/"
|
||||
target="_blank"
|
||||
>the instructions</a
|
||||
>
|
||||
to make sure that you have configured Home Assistant correctly.
|
||||
${this.hass.localize("ui.panel.config.script.picker.introduction")}
|
||||
<p>
|
||||
<a
|
||||
href="https://home-assistant.io/docs/scripts/editor/"
|
||||
target="_blank"
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.script.picker.learn_more"
|
||||
)}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<ha-card header="Pick script to edit">
|
||||
<ha-card
|
||||
header="${this.hass.localize(
|
||||
"ui.panel.config.script.picker.pick_script"
|
||||
)}"
|
||||
>
|
||||
${this.scripts.length === 0
|
||||
? html`
|
||||
<div class="card-content">
|
||||
<p>We couldn't find any scripts.</p>
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.script.picker.no_scripts"
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
`
|
||||
: this.scripts.map(
|
||||
@@ -85,7 +99,9 @@ class HaScriptPicker extends LitElement {
|
||||
slot="fab"
|
||||
?is-wide=${this.isWide}
|
||||
icon="hass:plus"
|
||||
title="Add Script"
|
||||
title="${this.hass.localize(
|
||||
"ui.panel.config.script.picker.add_script"
|
||||
)}"
|
||||
?rtl=${computeRTL(this.hass)}
|
||||
></ha-fab>
|
||||
</a>
|
||||
@@ -97,7 +113,11 @@ class HaScriptPicker extends LitElement {
|
||||
const script = ev.currentTarget.script as HassEntity;
|
||||
await triggerScript(this.hass, script.entity_id);
|
||||
showToast(this, {
|
||||
message: `Triggered ${computeStateName(script)}`,
|
||||
message: `${this.hass.localize(
|
||||
"ui.dialogs.notification_toast.triggered",
|
||||
"name",
|
||||
computeStateName(script)
|
||||
)}`,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user