diff --git a/js/panel-config/automation.js b/js/panel-config/automation.js
index 0b9f9197f2..3793fd7830 100644
--- a/js/panel-config/automation.js
+++ b/js/panel-config/automation.js
@@ -42,7 +42,7 @@ export default class Automation extends Component {
});
}
- render({ automation, isWide, hass }) {
+ render({ automation, isWide, hass, localize }) {
const {
alias, trigger, condition, action
} = automation;
@@ -52,12 +52,12 @@ export default class Automation extends Component {
{alias}
- Use automations to bring your home alive.
+ {localize('ui.panel.config.automation.editor.introduction')}
- Triggers
+ {localize('ui.panel.config.automation.editor.triggers.header')}
- Triggers are what starts the processing of an automation rule.
- It is possible to specify multiple triggers for the same rule.
- Once a trigger starts, Home Assistant will validate the conditions,
- if any, and call the action.
-
- Learn more about triggers.
-
+
- Conditions
+ {localize('ui.panel.config.automation.editor.conditions.header')}
- Conditions are an optional part of an automation rule and can be used to prevent
- an action from happening when triggered. Conditions look very similar to triggers
- but are very different. A trigger will look at events happening in the system
- while a condition only looks at how the system looks right now. A trigger can
- observe that a switch is being turned on. A condition can only see if a switch
- is currently on or off.
-
- Learn more about conditions.
-
+
- Action
+ {localize('ui.panel.config.automation.editor.actions.header')}
- The actions are what Home Assistant will do when the automation is triggered.
-
- Learn more about actions.
-
+
diff --git a/js/panel-config/condition/condition_edit.js b/js/panel-config/condition/condition_edit.js
index 240244646c..cd4d5b323d 100644
--- a/js/panel-config/condition/condition_edit.js
+++ b/js/panel-config/condition/condition_edit.js
@@ -26,7 +26,7 @@ export default class ConditionRow extends Component {
}
typeChanged(ev) {
- const type = ev.target.selectedItem.innerHTML;
+ const type = ev.target.selectedItem.attributes.condition.value;
if (type !== this.props.condition.condition) {
this.props.onChange(this.props.index, {
@@ -36,14 +36,14 @@ export default class ConditionRow extends Component {
}
}
- render({ index, condition, onChange, hass }) {
+ render({ index, condition, onChange, hass, localize }) {
const Comp = TYPES[condition.condition];
const selected = OPTIONS.indexOf(condition.condition);
if (!Comp) {
return (
- Unsupported condition: {condition.condition}
+ {localize('ui.panel.config.automation.editor.conditions.unsupported_condition', 'condition', condition.condition)}
{JSON.stringify(condition, null, 2)}
);
@@ -51,13 +51,13 @@ export default class ConditionRow extends Component {
return (
-
+
- {OPTIONS.map(opt => {opt} )}
+ {OPTIONS.map(opt => {localize(`ui.panel.config.automation.editor.conditions.type.${opt}.label`)} )}
);
diff --git a/js/panel-config/condition/condition_row.js b/js/panel-config/condition/condition_row.js
index 87c83f80d7..8dd1e40067 100644
--- a/js/panel-config/condition/condition_row.js
+++ b/js/panel-config/condition/condition_row.js
@@ -11,7 +11,7 @@ export default class ConditionRow extends Component {
onDelete() {
// eslint-disable-next-line
- if (confirm('Sure you want to delete?')) {
+ if (confirm(this.props.localize('ui.panel.config.automation.editor.conditions.delete_confirm'))) {
this.props.onChange(this.props.index, null);
}
}
@@ -31,8 +31,8 @@ export default class ConditionRow extends Component {
slot="dropdown-trigger"
/>
- Duplicate
- Delete
+ {props.localize('ui.panel.config.automation.editor.conditions.duplicate')}
+ {props.localize('ui.panel.config.automation.editor.conditions.delete')}
diff --git a/js/panel-config/condition/index.js b/js/panel-config/condition/index.js
index d3d3a5ebd8..6aa464c40e 100644
--- a/js/panel-config/condition/index.js
+++ b/js/panel-config/condition/index.js
@@ -30,7 +30,7 @@ export default class Condition extends Component {
this.props.onChange(condition);
}
- render({ condition, hass }) {
+ render({ condition, hass, localize }) {
return (
{condition.map((cnd, idx) => (
@@ -39,10 +39,11 @@ export default class Condition extends Component {
condition={cnd}
onChange={this.conditionChanged}
hass={hass}
+ localize={localize}
/>))}
-
Add condition
+
{localize('ui.panel.config.automation.editor.conditions.add')}
diff --git a/js/panel-config/condition/numeric_state.js b/js/panel-config/condition/numeric_state.js
index a9b3a58879..2e52cf11d7 100644
--- a/js/panel-config/condition/numeric_state.js
+++ b/js/panel-config/condition/numeric_state.js
@@ -18,7 +18,7 @@ export default class NumericStateCondition extends Component {
}
/* eslint-disable camelcase */
- render({ condition, hass }) {
+ render({ condition, hass, localize }) {
const {
value_template, entity_id, below, above
} = condition;
@@ -31,19 +31,19 @@ export default class NumericStateCondition extends Component {
allowCustomEntity
/>
- Before:
+ {localize('ui.panel.config.automation.editor.conditions.type.sun.before')}
- Sunrise
- Sunset
+ {localize('ui.panel.config.automation.editor.conditions.type.sun.sunrise')}
+ {localize('ui.panel.config.automation.editor.conditions.type.sun.sunset')}
- After:
+ {localize('ui.panel.config.automation.editor.conditions.type.sun.after')}
- Sunrise
- Sunset
+ {localize('ui.panel.config.automation.editor.conditions.type.sun.sunrise')}
+ {localize('ui.panel.config.automation.editor.conditions.type.sun.sunset')}
diff --git a/js/panel-config/script/action_edit.js b/js/panel-config/script/action_edit.js
index f87498404e..485075078a 100644
--- a/js/panel-config/script/action_edit.js
+++ b/js/panel-config/script/action_edit.js
@@ -7,11 +7,11 @@ import EventAction from './event.js';
import WaitAction from './wait.js';
const TYPES = {
- 'Call Service': CallServiceAction,
- Delay: DelayAction,
- Wait: WaitAction,
- Condition: ConditionAction,
- 'Fire Event': EventAction,
+ service: CallServiceAction,
+ delay: DelayAction,
+ wait_template: WaitAction,
+ condition: ConditionAction,
+ event: EventAction,
};
const OPTIONS = Object.keys(TYPES).sort();
@@ -19,7 +19,7 @@ const OPTIONS = Object.keys(TYPES).sort();
function getType(action) {
const keys = Object.keys(TYPES);
for (let i = 0; i < keys.length; i++) {
- if (TYPES[keys[i]].configKey in action) {
+ if (keys[i] in action) {
return keys[i];
}
}
@@ -34,7 +34,7 @@ export default class Action extends Component {
}
typeChanged(ev) {
- const newType = ev.target.selectedItem.innerHTML;
+ const newType = ev.target.selectedItem.attributes.action.value;
const oldType = getType(this.props.action);
if (oldType !== newType) {
@@ -42,7 +42,7 @@ export default class Action extends Component {
}
}
- render({ index, action, onChange, hass }) {
+ render({ index, action, onChange, hass, localize }) {
const type = getType(action);
const Comp = type && TYPES[type];
const selected = OPTIONS.indexOf(type);
@@ -50,20 +50,20 @@ export default class Action extends Component {
if (!Comp) {
return (
- Unsupported action
+ {localize('ui.panel.config.automation.editor.actions.unsupported_action', 'action', type)}
{JSON.stringify(action, null, 2)}
);
}
return (
-
+
- {OPTIONS.map(opt => {opt} )}
+ {OPTIONS.map(opt => {localize(`ui.panel.config.automation.editor.actions.type.${opt}.label`)} )}
);
diff --git a/js/panel-config/script/action_row.js b/js/panel-config/script/action_row.js
index 600106288b..286951fbd3 100644
--- a/js/panel-config/script/action_row.js
+++ b/js/panel-config/script/action_row.js
@@ -11,7 +11,7 @@ export default class Action extends Component {
onDelete() {
// eslint-disable-next-line
- if (confirm('Sure you want to delete?')) {
+ if (confirm(this.props.localize('ui.panel.config.automation.editor.actions.delete_confirm'))) {
this.props.onChange(this.props.index, null);
}
}
@@ -31,8 +31,8 @@ export default class Action extends Component {
slot="dropdown-trigger"
/>
- Duplicate
- Delete
+ {props.localize('ui.panel.config.automation.editor.actions.duplicate')}
+ {props.localize('ui.panel.config.automation.editor.actions.delete')}
diff --git a/js/panel-config/script/call_service.js b/js/panel-config/script/call_service.js
index 5375715e5e..246fab07ff 100644
--- a/js/panel-config/script/call_service.js
+++ b/js/panel-config/script/call_service.js
@@ -24,7 +24,7 @@ export default class CallServiceAction extends Component {
});
}
- render({ action, hass }) {
+ render({ action, hass, localize }) {
const { service, data } = action;
return (
@@ -35,7 +35,7 @@ export default class CallServiceAction extends Component {
onChange={this.serviceChanged}
/>
@@ -44,7 +44,6 @@ export default class CallServiceAction extends Component {
}
}
-CallServiceAction.configKey = 'service';
CallServiceAction.defaultConfig = {
alias: '',
service: '',
diff --git a/js/panel-config/script/condition.js b/js/panel-config/script/condition.js
index 071eb91a56..3fcea7657c 100644
--- a/js/panel-config/script/condition.js
+++ b/js/panel-config/script/condition.js
@@ -5,19 +5,19 @@ import ConditionEdit from '../condition/condition_edit.js';
export default class ConditionAction extends Component {
// eslint-disable-next-line
- render({ action, index, onChange, hass }) {
+ render({ action, index, onChange, hass, localize }) {
return (
);
}
}
-ConditionAction.configKey = 'condition';
ConditionAction.defaultConfig = {
condition: 'state',
...StateCondition.defaultConfig,
diff --git a/js/panel-config/script/delay.js b/js/panel-config/script/delay.js
index cec32cba8d..02add9fe3f 100644
--- a/js/panel-config/script/delay.js
+++ b/js/panel-config/script/delay.js
@@ -8,12 +8,12 @@ export default class DelayAction extends Component {
this.onChange = onChangeEvent.bind(this, 'action');
}
- render({ action }) {
+ render({ action, localize }) {
const { delay } = action;
return (
@@ -39,7 +39,6 @@ export default class EventAction extends Component {
}
}
-EventAction.configKey = 'event';
EventAction.defaultConfig = {
event: '',
event_data: {},
diff --git a/js/panel-config/script/index.js b/js/panel-config/script/index.js
index 2d5ec54507..6c48e394ae 100644
--- a/js/panel-config/script/index.js
+++ b/js/panel-config/script/index.js
@@ -30,7 +30,7 @@ export default class Script extends Component {
this.props.onChange(script);
}
- render({ script, hass }) {
+ render({ script, hass, localize }) {
return (
{script.map((act, idx) => (
@@ -39,10 +39,11 @@ export default class Script extends Component {
action={act}
onChange={this.actionChanged}
hass={hass}
+ localize={localize}
/>))}
-
Add action
+
{localize('ui.panel.config.automation.editor.actions.add')}
diff --git a/js/panel-config/script/wait.js b/js/panel-config/script/wait.js
index 6bf5d266eb..22ac63ba28 100644
--- a/js/panel-config/script/wait.js
+++ b/js/panel-config/script/wait.js
@@ -18,19 +18,19 @@ export default class WaitAction extends Component {
});
}
- render({ action }) {
+ render({ action, localize }) {
/* eslint-disable camelcase */
const { wait_template, timeout } = action;
return (
diff --git a/js/panel-config/trigger/homeassistant.js b/js/panel-config/trigger/homeassistant.js
index 6d43225a89..a27f96b61a 100644
--- a/js/panel-config/trigger/homeassistant.js
+++ b/js/panel-config/trigger/homeassistant.js
@@ -15,18 +15,18 @@ export default class HassTrigger extends Component {
}
/* eslint-disable camelcase */
- render({ trigger }) {
+ render({ trigger, localize }) {
const { event } = trigger;
return (
-
Event:
+
{localize('ui.panel.config.automation.editor.triggers.type.homeassistant.event')}
- Start
- Shutdown
+ {localize('ui.panel.config.automation.editor.triggers.type.homeassistant.start')}
+ {localize('ui.panel.config.automation.editor.triggers.type.homeassistant.shutdown')}
);
diff --git a/js/panel-config/trigger/index.js b/js/panel-config/trigger/index.js
index 5f61fb2025..dcc453bea3 100644
--- a/js/panel-config/trigger/index.js
+++ b/js/panel-config/trigger/index.js
@@ -32,7 +32,7 @@ export default class Trigger extends Component {
this.props.onChange(trigger);
}
- render({ trigger, hass }) {
+ render({ trigger, hass, localize }) {
return (
{trigger.map((trg, idx) => (
@@ -41,10 +41,11 @@ export default class Trigger extends Component {
trigger={trg}
onChange={this.triggerChanged}
hass={hass}
+ localize={localize}
/>))}
-
Add trigger
+
{localize('ui.panel.config.automation.editor.triggers.add')}
diff --git a/js/panel-config/trigger/mqtt.js b/js/panel-config/trigger/mqtt.js
index c475f1c0a4..fb66a8c803 100644
--- a/js/panel-config/trigger/mqtt.js
+++ b/js/panel-config/trigger/mqtt.js
@@ -10,18 +10,18 @@ export default class MQTTTrigger extends Component {
}
/* eslint-disable camelcase */
- render({ trigger }) {
+ render({ trigger, localize }) {
const { topic, payload } = trigger;
return (
- Event:
+ {localize('ui.panel.config.automation.editor.triggers.type.sun.event')}
- Sunrise
- Sunset
+ {localize('ui.panel.config.automation.editor.triggers.type.sun.sunrise')}
+ {localize('ui.panel.config.automation.editor.triggers.type.sun.sunset')}
- Unsupported platform: {trigger.platform}
+ {localize('ui.panel.config.automation.editor.triggers.unsupported_platform', 'platform', trigger.platform)}
{JSON.stringify(trigger, null, 2)}
);
}
return (
-
+
- {OPTIONS.map(opt => {opt} )}
+ {OPTIONS.map(opt => {localize(`ui.panel.config.automation.editor.triggers.type.${opt}.label`)} )}
);
diff --git a/js/panel-config/trigger/trigger_row.js b/js/panel-config/trigger/trigger_row.js
index 18195aabab..0cd1fe767d 100644
--- a/js/panel-config/trigger/trigger_row.js
+++ b/js/panel-config/trigger/trigger_row.js
@@ -11,7 +11,7 @@ export default class TriggerRow extends Component {
onDelete() {
// eslint-disable-next-line
- if (confirm('Sure you want to delete?')) {
+ if (confirm(this.props.localize('ui.panel.config.automation.editor.triggers.delete_confirm'))) {
this.props.onChange(this.props.index, null);
}
}
@@ -31,8 +31,8 @@ export default class TriggerRow extends Component {
slot="dropdown-trigger"
/>
- Duplicate
- Delete
+ {props.localize('ui.panel.config.automation.editor.triggers.duplicate')}
+ {props.localize('ui.panel.config.automation.editor.triggers.delete')}
diff --git a/js/panel-config/trigger/zone.js b/js/panel-config/trigger/zone.js
index 833274fa8c..47996cffa3 100644
--- a/js/panel-config/trigger/zone.js
+++ b/js/panel-config/trigger/zone.js
@@ -40,12 +40,12 @@ export default class ZoneTrigger extends Component {
}
/* eslint-disable camelcase */
- render({ trigger, hass }) {
+ render({ trigger, hass, localize }) {
const { entity_id, zone, event } = trigger;
return (
-
Event:
+
{localize('ui.panel.config.automation.editor.triggers.type.zone.event')}
- Enter
- Leave
+ {localize('ui.panel.config.automation.editor.triggers.type.zone.enter')}
+ {localize('ui.panel.config.automation.editor.triggers.type.zone.leave')}
);
diff --git a/panels/config/automation/ha-automation-editor.html b/panels/config/automation/ha-automation-editor.html
index 65f260463f..b7cbd6497a 100644
--- a/panels/config/automation/ha-automation-editor.html
+++ b/panels/config/automation/ha-automation-editor.html
@@ -17,6 +17,7 @@
+
@@ -89,7 +90,7 @@
icon='mdi:arrow-left'
on-click='backTapped'
>
- Automation [[name]]
+ [[name]]
@@ -103,7 +104,7 @@
is-wide$='[[isWide]]'
dirty$='[[dirty]]'
icon='mdi:content-save'
- title='Save'
+ title="[[localize('ui.panel.config.automation.editor.save')]]"
on-click='saveAutomation'
>
@@ -112,7 +113,12 @@