piitaya / lovelace-mushroom

Build a beautiful Home Assistant dashboard easily
Apache License 2.0
3.7k stars 340 forks source link

[Feature]: Localize states in template card #1234

Open LavermanJJ opened 1 year ago

LavermanJJ commented 1 year ago

Requirements

Is your feature request related to a problem?

When using the entity-card, the state of an entity is displayed localized, which is nice. However, if I build a more complex card using the template-card, the state is not localized.

Describe the solution you'd like

For the entity-card the computation of the localized state is done within computeStateDisplay (if I got it correctly). Not sure if this is even possible, but it would be great if the template state is also localized.

Is the template expression rendered in the backend, or front-end? If so, this might be a HA issue, as I the localization is done within the front-end, right?

Describe alternatives you've considered

Finding a way to get a localized result from the Jinja template. However, localization is done in the front-end.

Additional context

No response

piitaya commented 1 year ago

Template are rendered in the back end while localization is done front-end side. That why we don't have translation support for template. Do you have a card example of why you need this feature?

LavermanJJ commented 1 year ago

Thanks for your quick reply and this awesome project 👍

Great question. There are basically two things I'd like to accomplish: 1) The first would be solved, by having a dedicated water-heater-card for water-heater entities. Similar to the climate-card, it would show the current operation and the temperature. The limitation of using the climate-card for water-heater, is that it cannot interpret the on/off state, cf #788 So far, I only developed within the HA back-end, but if you like, I could try to add the water-heater-card?

2) The second could be solved, by adding badges to entity-card. This is of not so much importance to me.

piitaya commented 1 year ago

Yes, it makes more sense to have a dedicated card for water heater 😉 It's very similar but there are some differences : operation mode, no action attributes, etc... You can try or I will if you don't have time.

AlessandroTischer commented 1 year ago

Yes, it makes more sense to have a dedicated card for water heater 😉 It's very similar but there are some differences : operation mode, no action attributes, etc... You can try or I will if you don't have time.

Has there been any progress in this regard?

AlessandroTischer commented 4 months ago

Yes, it makes more sense to have a dedicated card for water heater 😉 It's very similar but there are some differences : operation mode, no action attributes, etc... You can try or I will if you don't have time.

Sorry to bother again, but I would like to know if there is something I can do to help (though I wouldn't know where to start in this specific case, I have some programming knowledge)