Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fr and en translations #22

Merged
merged 1 commit into from
Jan 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .hass_dev/views/alarm-control-panel-view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ cards:
- armed_away
name: Text code (azerty)
- type: grid
title: Layouts
title: Vertical
cards:
- type: custom:mushroom-alarm-control-panel-card
entity: alarm_control_panel.alarm_panel_1
vertical: true
- type: custom:mushroom-alarm-control-panel-card
entity: alarm_control_panel.alarm_panel_1
hide_state: true
- type: custom:mushroom-alarm-control-panel-card
entity: alarm_control_panel.alarm_panel_1
vertical: true
Expand Down
5 changes: 1 addition & 4 deletions .hass_dev/views/cover-view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ cards:
show_buttons_control: true
show_position_control: true
- type: grid
title: Layouts
title: Vertical
cards:
- type: custom:mushroom-cover-card
entity: cover.living_room_window
vertical: true
- type: custom:mushroom-cover-card
entity: cover.living_room_window
hide_state: true
- type: custom:mushroom-cover-card
entity: cover.living_room_window
vertical: true
Expand Down
5 changes: 1 addition & 4 deletions .hass_dev/views/fan-view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ cards:
columns: 2
square: false
- type: grid
title: Layouts
title: Vertical
cards:
- type: custom:mushroom-fan-card
entity: fan.living_room_fan
vertical: true
- type: custom:mushroom-fan-card
entity: fan.living_room_fan
hide_state: true
- type: custom:mushroom-fan-card
entity: fan.living_room_fan
vertical: true
Expand Down
5 changes: 1 addition & 4 deletions .hass_dev/views/light-view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ cards:
show_brightness_control: true
show_color_temp_control: true
- type: grid
title: Layouts
title: Vertical
cards:
- type: custom:mushroom-light-card
entity: light.bed_light
vertical: true
- type: custom:mushroom-light-card
entity: light.bed_light
hide_state: true
- type: custom:mushroom-light-card
entity: light.bed_light
vertical: true
Expand Down
5 changes: 1 addition & 4 deletions .hass_dev/views/person-view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ cards:
columns: 2
square: false
- type: grid
title: Layouts
title: Vertical
cards:
- type: custom:mushroom-person-card
entity: person.anne_therese
vertical: true
- type: custom:mushroom-person-card
entity: person.anne_therese
hide_state: true
- type: custom:mushroom-person-card
entity: person.anne_therese
vertical: true
Expand Down
5 changes: 1 addition & 4 deletions .hass_dev/views/switch-view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ cards:
columns: 2
square: false
- type: grid
title: Layouts
title: Vertical
cards:
- type: custom:mushroom-switch-card
entity: switch.decorative_lights
vertical: true
- type: custom:mushroom-switch-card
entity: switch.decorative_lights
hide_state: true
- type: custom:mushroom-switch-card
entity: switch.decorative_lights
vertical: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators.js";
import { assert } from "superstruct";
import setupCustomlocalize from "../../localize";
import { configElementStyle } from "../../utils/editor-styles";
import { EditorTarget } from "../../utils/lovelace/editor/types";
import {
Expand Down Expand Up @@ -58,6 +59,8 @@ export class SwitchCardEditor extends LitElement implements LovelaceCardEditor {
"armed_custom_bypass",
];

const customLocalize = setupCustomlocalize(this.hass);

return html`
<div class="card-config">
<ha-entity-picker
Expand Down Expand Up @@ -95,14 +98,22 @@ export class SwitchCardEditor extends LitElement implements LovelaceCardEditor {
></ha-icon-picker>
</div>
<div class="side-by-side">
<ha-formfield label="Vertical?" .dir=${dir}>
<ha-formfield
.label=${customLocalize("editor.card.generic.vertical")}
.dir=${dir}
>
<ha-switch
.checked=${!!this._config.vertical}
.configValue=${"vertical"}
@change=${this._valueChanged}
></ha-switch>
</ha-formfield>
<ha-formfield label="Hide state?" .dir=${dir}>
<ha-formfield
.label=${customLocalize(
"editor.card.generic.hide_state"
)}
.dir=${dir}
>
<ha-switch
.checked=${!!this._config.hide_state}
.configValue=${"hide_state"}
Expand All @@ -112,7 +123,12 @@ export class SwitchCardEditor extends LitElement implements LovelaceCardEditor {
</div>
<div class="side-by-side">
<div>
<span>Used States</span> ${this._states.map(
<span
>${customLocalize(
"editor.card.alarm_control_panel.displayed_states"
)}</span
>
${this._states.map(
(entityState, index) => html`
<div class="states">
<paper-item>${entityState}</paper-item>
Expand Down
21 changes: 13 additions & 8 deletions src/cards/chips-card/chips-card-chips-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { customElement, property, state } from "lit/decorators.js";
import { guard } from "lit/directives/guard.js";
import type { SortableEvent } from "sortablejs";
import setupCustomlocalize from "../../localize";
import { LovelaceChipConfig } from "../../utils/lovelace/chip/types";
import { sortableStyles } from "../../utils/sortable-styles";
import { computeChipComponentName } from "./utils";
Expand Down Expand Up @@ -53,10 +54,14 @@ export class ChipsCardEditorChips extends LitElement {
return html``;
}

const customLocalize = setupCustomlocalize(this.hass);

return html`
<h3>
${this.label ||
`Chips (${this.hass!.localize(
`${customLocalize(
"editor.chip.chip-picker.chips"
)} (${this.hass!.localize(
"ui.panel.lovelace.editor.card.config.required"
)})`}
</h3>
Expand All @@ -80,16 +85,16 @@ export class ChipsCardEditorChips extends LitElement {
)}
</span>
<span class="secondary"
>${this.hass!.localize(
"ui.panel.lovelace.editor.card.entities.edit_special_row"
>${customLocalize(
"editor.chip.chip-picker.details"
)}</span
>
</div>
</div>
`}
<ha-icon-button
.label=${this.hass!.localize(
"ui.components.entity.entity-picker.clear"
.label=${customLocalize(
"editor.chip.chip-picker.clear"
)}
class="remove-icon"
.index=${index}
Expand All @@ -98,8 +103,8 @@ export class ChipsCardEditorChips extends LitElement {
<ha-icon icon="mdi:close"></ha-icon
></ha-icon-button>
<ha-icon-button
.label=${this.hass!.localize(
"ui.components.entity.entity-picker.edit"
.label=${customLocalize(
"editor.chip.chip-picker.edit"
)}
class="edit-icon"
.index=${index}
Expand All @@ -113,7 +118,7 @@ export class ChipsCardEditorChips extends LitElement {
)}
</div>
<paper-dropdown-menu
placeholder="Chip"
.placeholder=${customLocalize("editor.chip.chip-picker.add")}
@iron-select=${this._addChips}
>
<paper-listbox
Expand Down
40 changes: 12 additions & 28 deletions src/cards/chips-card/chips/action-chip-editor.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import {
ActionConfig,
fireEvent,
HomeAssistant,
stateIcon,
} from "custom-card-helpers";
import { fireEvent, HomeAssistant } from "custom-card-helpers";
import { CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators.js";
import setupCustomlocalize from "../../../localize";
import { configElementStyle } from "../../../utils/editor-styles";
import { ActionChipConfig } from "../../../utils/lovelace/chip/types";
import { EditorTarget } from "../../../utils/lovelace/editor/types";
Expand All @@ -24,27 +20,13 @@ export class EntityChipEditor extends LitElement implements LovelaceChipEditor {
this._config = config;
}

get _icon(): string {
return this._config!.icon || "";
}

get _icon_color(): string {
return this._config!.icon_color || "";
}

get _tap_action(): ActionConfig | undefined {
return this._config!.tap_action;
}

get _hold_action(): ActionConfig | undefined {
return this._config!.hold_action;
}

protected render(): TemplateResult {
if (!this.hass || !this._config) {
return html``;
}

const customlocalize = setupCustomlocalize(this.hass);

return html`
<div class="card-config">
<div class="side-by-side">
Expand All @@ -54,16 +36,18 @@ export class EntityChipEditor extends LitElement implements LovelaceChipEditor {
)} (${this.hass.localize(
"ui.panel.lovelace.editor.card.config.optional"
)})"
.value=${this._icon}
.placeholder=${this._icon || "mdi:flash"}
.value=${this._config.icon}
.placeholder=${this._config.icon || "mdi:flash"}
.configValue=${"icon"}
@value-changed=${this._valueChanged}
></ha-icon-picker>
<paper-input
.label="Icon color (${this.hass.localize(
.label="${customlocalize(
"editor.chip.generic.icon_color"
)} (${this.hass.localize(
"ui.panel.lovelace.editor.card.config.optional"
)})"
.value=${this._icon_color}
.value=${this._config.icon_color}
.configValue=${"icon_color"}
@value-changed=${this._valueChanged}
></paper-input>
Expand All @@ -76,7 +60,7 @@ export class EntityChipEditor extends LitElement implements LovelaceChipEditor {
"ui.panel.lovelace.editor.card.config.optional"
)})"
.hass=${this.hass}
.config=${this._tap_action}
.config=${this._config.tap_action}
.actions=${actions}
.configValue=${"tap_action"}
.tooltipText=${this.hass.localize(
Expand All @@ -91,7 +75,7 @@ export class EntityChipEditor extends LitElement implements LovelaceChipEditor {
"ui.panel.lovelace.editor.card.config.optional"
)})"
.hass=${this.hass}
.config=${this._hold_action}
.config=${this._config.hold_action}
.actions=${actions}
.configValue=${"hold_action"}
.tooltipText=${this.hass.localize(
Expand Down
21 changes: 9 additions & 12 deletions src/cards/chips-card/chips/back-chip-editor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { fireEvent, HomeAssistant } from "custom-card-helpers";
import { CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators.js";
import setupCustomlocalize from "../../../localize";
import { configElementStyle } from "../../../utils/editor-styles";
import { EntityChipConfig } from "../../../utils/lovelace/chip/types";
import { EditorTarget } from "../../../utils/lovelace/editor/types";
Expand All @@ -17,19 +18,13 @@ export class BackChipEditor extends LitElement implements LovelaceChipEditor {
this._config = config;
}

get _icon(): string {
return this._config!.icon || "";
}

get _icon_color(): string {
return this._config!.icon_color || "";
}

protected render(): TemplateResult {
if (!this.hass || !this._config) {
return html``;
}

const customlocalize = setupCustomlocalize(this.hass);

return html`
<div class="card-config">
<div class="side-by-side">
Expand All @@ -39,16 +34,18 @@ export class BackChipEditor extends LitElement implements LovelaceChipEditor {
)} (${this.hass.localize(
"ui.panel.lovelace.editor.card.config.optional"
)})"
.value=${this._icon}
.placeholder=${this._icon || "mdi:arrow-left"}
.value=${this._config.icon}
.placeholder=${this._config.icon || "mdi:arrow-left"}
.configValue=${"icon"}
@value-changed=${this._valueChanged}
></ha-icon-picker>
<paper-input
.label="Icon color (${this.hass.localize(
.label="${customlocalize(
"editor.chip.generic.icon_color"
)} (${this.hass.localize(
"ui.panel.lovelace.editor.card.config.optional"
)})"
.value=${this._icon_color}
.value=${this._config.icon_color}
.configValue=${"icon_color"}
@value-changed=${this._valueChanged}
></paper-input>
Expand Down
Loading