DBuit/light-popup-card

0.4.8 overwrites system language when sliding light to off

matt8707 opened this issue · 5 comments

Release 0.4.8 seems to overwrite system language when sliding light to off. Prior versions works as expected.

Maybe relevant

if(el) {el.dataset.value = value+"%";}

if(el) {el.innerText = (value == 0) ? "Off" : value + "%";}

DBuit commented

Where did you find that code?
I use this.hass.localize(component.light.state._.off) to the translation for the off state in the language of the hass instalation IT is running

So I think the localization is working but it happens when sliding to 0%

if(el) {el.innerText = (value == 0) ? "Off" : value + "%";}

  • If I open a popup with a light that is off it says 'Av'
  • Turn it on to 50%
  • Slide it down to 0% and it says 'Off'
  • Reopen the popup and it says 'Av'
DBuit commented

when a light has a brightness of 0% it is automatically off

Yeah, I get that. It's the language used that changed.

I agree with @matt8707 :

  • when a light is off, and when I open this card, status is Éteinte (french)
  • when I light up and switch off the light inside the card, status becomes Off
  • when I close this card, and reopen it, status is Éteinte again

So, when the card is opened, and the light switched off, locale is not taken into account.

This is not a big issue, but it would be cool to solve it !