Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Template Card doesn't respect decimal separator locale #1315

Open
2 tasks done
richardvinger opened this issue Dec 24, 2023 · 4 comments
Open
2 tasks done

[Bug]: Template Card doesn't respect decimal separator locale #1315

richardvinger opened this issue Dec 24, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@richardvinger
Copy link

richardvinger commented Dec 24, 2023

Requirements

  • I checked the troubleshooting section in the README to verify that I have the latest Mushroom version.
  • I did a search to see if there is a similar issue or if a pull request is open.

Current Behavior

If an entity has a floating point value, it looks like the template card will always use the period (".") as the decimal separator.

Expected Behavior

Some locales use a comma as the decimal separator (","). Mushroom should use the separator as dictated by the selected locale in HA. In my case, since I'm using my HA environment in Dutch (nl-NL), where "," is used as the decimal separator, Mushroom should inherit this.

Steps To Reproduce

  1. Change the Home Assistant locale to any language where "," is the decimal separator (e.g. Dutch, Netherlands, nl-NL).
  2. Ensure you have an entity with a floating point value (e.g. "5,23", with "," being the decimal separator).
  3. Create a template card that shows the aforementioned entity.

The screenshot below first shows the default HA entity card, which displays the decimal separator as expected, followed by the template card, which uses the incorrect decimal separator. (Additionally, it also doesn't appear to take precision into account as set in the HA UI, about which I commented here.)

shown properly by default cards but not mushroom

Context

No response

Environment

- Browser: Chrome latest
- HA Version: 2023.12
- Mushroom: 3.2.2

Anything else?

No response

@richardvinger richardvinger added the bug Something isn't working label Dec 24, 2023
@pyrocumulus
Copy link

pyrocumulus commented Jan 21, 2024

In addition to the decimal separator not using the user's locale, the thousands separator is completely missing:

image
Lovelace mushroom to the left, HA Core Entity to the right

It should've been a single . in my own selected locale, or , if it was defaulting to my language setting (English GB). However there appears to be no thousands separators at all.

Version information:

Core: 2024.1.5
Supervisor: 2023.12.1
Operating System: 11.4
Frontend: 20240104.0
Mushroom: 3.2.4

@richardvinger
Copy link
Author

Another issue related to this: when a relative time is displayed (e.g. "In 4 hours"), English words like "hours" and "minutes" will be used instead of deferring to the UI language.

@richardvinger
Copy link
Author

@piitaya Would you be able to weigh in here?

@piitaya
Copy link
Owner

piitaya commented Feb 6, 2024

Hello 👋 Mushroom uses the core template engine (https://www.home-assistant.io/docs/configuration/templating/) and this is not translated and use english formatting for numbers. We can do nothing on Mushroom to fix it 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants