tomvanswam / compass-card

A Lovelace card that shows a directional indicator on a compass for Home Assistant
MIT License
172 stars 19 forks source link

Translation of directions N-E-S-W #22

Closed rainer-geiger closed 4 years ago

rainer-geiger commented 4 years ago

First off I want to say that this card is amazing!

But I have a suggestion for improvement: Is it possible to introduce a translation of the "directional letters" in the configuration? I'm from Germany and in German for example "east" means "Osten". So it would be great if I could change the letters NESW according to my language.

Maybe something like this:

- compass:
          indicator: arrow_inward
          show_north: true
   direction_offset: 180
   entity: sensor.wind_bearing
   secondary_entity: sensor.wind_speed
   name: Wind
   translate:
          north: N
          east: O
          south: S
          west: W
   type: 'custom:compass-card'
tomvanswam commented 4 years ago

Thanks for your feedback!

I was planning on using the integrated translation in Home Assistant for translation, instead of putting translation in the yaml.

This would work for you when your Home Assistant language is set to German or to automatic and your browser sais to use German. If your configuration page is in German, your good.

I'd like to know if your Home Assistant is in German, and if you use a localized weather integration whether its string direction state has its states in German.

If you could find the time, could you help out translating the strings in this file? Then all stuff will be in German.

dhover commented 4 years ago

I also would like to have the directions translated in Dutch. I' m using Home Assistant in English language because I like the original menu's and messages for troubleshooting.

tomvanswam commented 4 years ago

Ok good to know, so i would need to implement a forcing mechanism to pick a language different from the ui for the abbreviations.

rainer-geiger commented 4 years ago

Homeassistant is set to German. My weather integration is "DWD Deutscher Wetterdienst". The integration has no string direction state, only numerical value in degrees:

temperature: 21.5
humidity: 86
pressure: 1009.6
wind_bearing: 261
wind_speed: 1.5
visibility: 10.3
attribution: Data provided by Deutscher Wetterdienst (DWD)
forecast:
  - datetime: '2020-08-17'
    condition: lightning-rainy
    temperature: 22.4
    templow: 16.6
    precipitation: 7.4
    precipitation_probability: 71
  - [...]
latest_update_utc: '2020-08-17T10:02:55.370955+00:00'
forecast_time_utc: '2020-08-17T09:00:00+00:00'
station_id: EXXX
station_name: Wetter Zuhause

I've done the German translation, can I push it to dev?

tomvanswam commented 4 years ago

Thanks a lot for the translation. Please use a pull request, instead of a direct push to dev.

I'm working on getting the abbreviation language independant from the HA language when that is done, the German language will be included in the next release.

tomvanswam commented 4 years ago

I've done the German translation, can I push it to dev?

If creating a pull request is to much of a hassle, you can post the translation file here too.

rainer-geiger commented 4 years ago

Ok, cool, that's actually just easier for me ;-)

{
  "common": {
    "version": "Version",
    "description": "Zeigt einen Kompass mit einem Indikator in Richtung des Entitätswertes an",
    "invalid_configuration": "Ungültige Konfiguration",
    "no_entity": "Entität nicht konfiguriert",
    "offset_not_a_number": "Richtungs-Offset ist keine Zahl",
    "invalid": "ungültig",
    "on": "An",
    "off": "Aus"
  },
  "editor": {
    "name": "Name",
    "optional": "Optional",
    "entity": "Entität",
    "required": "Benötigt",
    "primary": "Richtung",
    "secondary": "Sekundär",
    "indicator": "Indikator",
    "direction": "Richtung",
    "offset": "Offset",
    "show": "Zeige",
    "north": "Norden",
    "toggle": "Umschalten"
  },
  "directions": {
    "north": "Norden",
    "east": "Osten",
    "south": "Süden",
    "west": "Westen",
    "N": "N",
    "NNE": "NNO",
    "NE": "NO",
    "ENE": "ONO",
    "E": "O",
    "ESE": "OSO",
    "SE": "SO",
    "SSE": "SSO",
    "S": "S",
    "SSW": "SSW",
    "SW": "SW",
    "WSW": "WSW",
    "W": "W",
    "WNW": "WNW",
    "NW": "NW",
    "NNW": "NNW"
  }
}