Made thermostat history graph localizable (#4004)

* Made thermostat history graph localizable

* Changed string concatenation with white spaces from .join() to template literal

* Used variables in translations instead of template literals

* Update src/translations/en.json

Removed unnecessary space in heating value

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
springstan 2019-10-17 23:28:12 +02:00 committed by Bram Kragten
parent 982966c8d9
commit 035057b185
2 changed files with 53 additions and 6 deletions

View File

@ -181,23 +181,63 @@ class StateHistoryChartLine extends LocalizeMixin(PolymerElement) {
state.attributes.target_temp_low
);
addColumn(name + " current temperature", true);
addColumn(
`${this.hass.localize(
"ui.card.climate.current_temperature",
"name",
name
)}`,
true
);
if (hasHeat) {
addColumn(name + " heating", true, true);
addColumn(
`${this.hass.localize("ui.card.climate.heating", "name", name)}`,
true,
true
);
// The "heating" series uses steppedArea to shade the area below the current
// temperature when the thermostat is calling for heat.
}
if (hasCool) {
addColumn(name + " cooling", true, true);
addColumn(
`${this.hass.localize("ui.card.climate.cooling", "name", name)}`,
true,
true
);
// The "cooling" series uses steppedArea to shade the area below the current
// temperature when the thermostat is calling for heat.
}
if (hasTargetRange) {
addColumn(name + " target temperature high", true);
addColumn(name + " target temperature low", true);
addColumn(
`${this.hass.localize(
"ui.card.climate.target_temperature_mode",
"name",
name,
"mode",
this.hass.localize("ui.card.climate.high")
)}`,
true
);
addColumn(
`${this.hass.localize(
"ui.card.climate.target_temperature_mode",
"name",
name,
"mode",
this.hass.localize("ui.card.climate.low")
)}`,
true
);
} else {
addColumn(name + " target temperature", true);
addColumn(
`${this.hass.localize(
"ui.card.climate.target_temperature_entity",
"name",
name
)}`,
true
);
}
states.states.forEach((state) => {

View File

@ -402,6 +402,13 @@
"currently": "Currently",
"on_off": "On / off",
"target_temperature": "Target temperature",
"target_temperature_entity": "{name} target temperature",
"target_temperature_mode": "{name} target temperature {mode}",
"current_temperature": "{name} current temperature",
"heating": "{name} heating",
"cooling": "{name} cooling",
"high": "high",
"low": "low",
"target_humidity": "Target humidity",
"operation": "Operation",
"fan_mode": "Fan mode",