Home-Assistant-custom-components-INGV icon indicating copy to clipboard operation
Home-Assistant-custom-components-INGV copied to clipboard

Add unit of measurement localization

Open SiriosDev opened this issue 2 years ago • 5 comments

the sensor is great in English but in the other languages (currently it/pt) it is inconsistent, I wanted to open a PR but I didn't understand how to do it, I only found the translation files

SiriosDev avatar Sep 19 '23 11:09 SiriosDev

That's right. There is no unit of measurement for the number of earthquakes. The only units of measurement are those listed here. For this reason I chose to force a constant in English "quakes" as the unit of measurement. (another word that could be used would be "events")

caiosweet avatar Oct 10 '23 18:10 caiosweet

is it not possible to create a translation file for the unit of measurement? if Italian use terremoti(or maybe scosse) if English use quakes etc.

SiriosDev avatar Oct 10 '23 18:10 SiriosDev

I have no idea, but I can suggest a much quicker way that solves your problem. Use customize.

Just add something similar (see the code below) to the yaml configuration file, then choose restart and quick restart and you will have the unit of measurement that is inserted in the entity customization (my entity ID is sensor.ingv_earthquakes_casa_status, obviously you will have to use yours if it is different 😄)

homeassistant:
  customize:
    # Add an entry for each entity that you want to overwrite.
    sensor.ingv_earthquakes_casa_status:
      unit_of_measurement: "scosse"

caiosweet avatar Oct 10 '23 19:10 caiosweet

oh yes, I know, I already did. my intention was to help those who use this extension, making their life easier (specially for newbies)

SiriosDev avatar Oct 10 '23 20:10 SiriosDev

I have no idea if it can be done with the translation of the state or just the attributes, I should try when I have more free time. strings.json entity state attributes

caiosweet avatar Oct 10 '23 20:10 caiosweet