Skip to content

Commit f74c5e3

Browse files
committed
Use correct locale field on entity value formatting (#149, #162, #212)
1 parent 2ddfcf4 commit f74c5e3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/entity.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const entityStateDisplay = (hass, stateObj, config) => {
4545
}
4646
if (config.format.startsWith('precision')) {
4747
const precision = parseInt(config.format.slice(-1), 10);
48-
const formatted = formatNumber(parseFloat(value), hass.language, {
48+
const formatted = formatNumber(parseFloat(value), hass.locale, {
4949
minimumFractionDigits: precision,
5050
maximumFractionDigits: precision,
5151
});
@@ -55,12 +55,12 @@ export const entityStateDisplay = (hass, stateObj, config) => {
5555
}
5656

5757
if (config.attribute) {
58-
return `${isNaN(value) ? value : formatNumber(value, hass.language)}${unit ? ` ${unit}` : ''}`;
58+
return `${isNaN(value) ? value : formatNumber(value, hass.locale)}${unit ? ` ${unit}` : ''}`;
5959
}
6060

6161
const modifiedStateObj = { ...stateObj, attributes: { ...stateObj.attributes, unit_of_measurement: unit } };
6262

63-
return computeStateDisplay(hass.localize, modifiedStateObj, hass.language);
63+
return computeStateDisplay(hass.localize, modifiedStateObj, hass.locale);
6464
};
6565

6666
export const entityStyles = (config) =>

0 commit comments

Comments
 (0)