Skip to content

Commit

Permalink
Ticket #173: Thermostat view: Added translations for 'when/then'
Browse files Browse the repository at this point in the history
  • Loading branch information
frodeheg committed May 7, 2023
1 parent e3ebf23 commit 8211716
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
4 changes: 3 additions & 1 deletion locales/en.json
Expand Up @@ -532,6 +532,8 @@
"CoolNormal": "Normal cooling",
"CoolExpensive": "Expensive cooling",
"CoolExtreme": "Very expensive cooling",
"CoolOff": "Cooling off"
"CoolOff": "Cooling off",
"whenText": "when",
"thenText": "then"
}
}
4 changes: 3 additions & 1 deletion locales/fr.json
Expand Up @@ -532,6 +532,8 @@
"CoolNormal": "Refroidissement normal",
"CoolExpensive": "Refroidissement coûteux",
"CoolExtreme": "Refroidissement très cher",
"CoolOff": "Refroidissement désactivé"
"CoolOff": "Refroidissement désactivé",
"whenText": "quand",
"thenText": "alors"
}
}
4 changes: 3 additions & 1 deletion locales/nl.json
Expand Up @@ -532,6 +532,8 @@
"CoolNormal": "Normale koeling",
"CoolExpensive": "Dure koeling",
"CoolExtreme": "Zeer dure koeling",
"CoolOff": "Koelen uitgeschakeld"
"CoolOff": "Koelen uitgeschakeld",
"whenText": "wanneer",
"thenText": "dan"
}
}
4 changes: 3 additions & 1 deletion locales/no.json
Expand Up @@ -532,6 +532,8 @@
"CoolNormal": "Normal kjøling",
"CoolExpensive": "Dyr kjøling",
"CoolExtreme": "Veldig dyr kjøling",
"CoolOff": "Kjøling av"
"CoolOff": "Kjøling av",
"whenText": "når",
"thenText": ""
}
}
14 changes: 9 additions & 5 deletions settings/subpages/schedule.html
Expand Up @@ -292,6 +292,8 @@
<div style="display:none" data-i18n="thermostat.CoolExpensive" id="CoolExpensiveText"></div>
<div style="display:none" data-i18n="thermostat.CoolExtreme" id="CoolExtremeText"></div>
<div style="display:none" data-i18n="thermostat.CoolOff" id="CoolOffText"></div>
<div style="display:none" data-i18n="thermostat.whenText" id="whenText"></div>
<div style="display:none" data-i18n="thermostat.thenText" id="thenText"></div>

<!-- Help dialog -->
<div id="helpPage" class="helpBg" onclick="helpOff()">
Expand Down Expand Up @@ -1215,6 +1217,8 @@ <h3>Time Schedule Preview</h3>
onOffOp === DEVICE_OP.IGNORE
|| onOffOp === DEVICE_OP.UNCONDITIONAL_ON; // (None for on/off)
//onOffOp === DEVICE_OP.CONTROLLED_ON => Temp (onoff else)
const whenText = document.getElementById("whenText").innerHTML;
const thenText = document.getElementById("thenText").innerHTML;

// Dimensions
cWidth = canvas.width;
Expand Down Expand Up @@ -1329,8 +1333,8 @@ <h3>Time Schedule Preview</h3>
if (ACMode === ACMODE.PIGGY) centerText(ctx, heatText, tCenterX, tCenterY - 36*scaleFactor);
ctx.font = `${Math.round(10*scaleFactor*10)/10}px Verdana`;
const heatTriggerText = (ACMode === ACMODE.PIGGY) ? `< ${heatTrigger}°C` : `${heatText.toLowerCase()}`;
centerText(ctx, `when ${heatTriggerText}`, tCenterX, tCenterY - 22*scaleFactor);
centerText(ctx, `then ${text}°C`, tCenterX, tCenterY - 8*scaleFactor);
centerText(ctx, `${whenText} ${heatTriggerText}`, tCenterX, tCenterY - 22*scaleFactor);
centerText(ctx, `${thenText} ${text}°C`, tCenterX, tCenterY - 8*scaleFactor);
} else {
centerText(ctx, heatText, tCenterX, tCenterY - 30*scaleFactor);
centerText(ctx, `${text}°C`, tCenterX, tCenterY - 10*scaleFactor);
Expand Down Expand Up @@ -1392,8 +1396,8 @@ <h3>Time Schedule Preview</h3>
if (ACMode === ACMODE.PIGGY) centerText(ctx, coolText, tCenterX, tCenterY + 38*scaleFactor);
ctx.font = `${Math.round(10*scaleFactor*10)/10}px Verdana`;
const coolTriggerText = (ACMode === ACMODE.PIGGY) ? `> ${coolTrigger}°C` : `${coolText.toLowerCase()}`;
centerText(ctx, `when ${coolTriggerText}`, tCenterX, tCenterY + 8*scaleFactor);
centerText(ctx, `then ${text}°C`, tCenterX, tCenterY + 22*scaleFactor);
centerText(ctx, `${whenText} ${coolTriggerText}`, tCenterX, tCenterY + 8*scaleFactor);
centerText(ctx, `${thenText} ${text}°C`, tCenterX, tCenterY + 22*scaleFactor);
} else {
centerText(ctx, coolText, tCenterX, tCenterY + 30*scaleFactor);
centerText(ctx, `${text}°C`, tCenterX, tCenterY + 10*scaleFactor);
Expand All @@ -1418,7 +1422,7 @@ <h3>Time Schedule Preview</h3>
ctx.fill();
}
// Switch mode indicators:
if (showCool && showHeat) {
if (showCool && showHeat && ACMode === ACMODE.PIGGY) {
focusText = '‣';
ctx.fillStyle = `#800${(focus === 2) ? '1' : '4'}`;
centerAngle = tempToAngle(markerStartPos, markerEndPos, startTemp, endTemp, heatTrigger);
Expand Down

0 comments on commit 8211716

Please sign in to comment.