Villhellm/lovelace-clock-card

No translations

nepozs opened this issue · 7 comments

It's not strictly an issue, but it would be nice if there was a mechanism for use localizations.

Localizations in what way? The name of the time zone in other languages?

No, I suppose timezone name is standarized, but I mean translation day and month names.
Screenshot_2020-10-13 Drugi - Home Assistant_edit
so tables

    var dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
    var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

could be in separate file

and for example in polish it should look like

    var dayNames = ["Niedz.", "Pon.", "Wt.", "Śr.", "Czw.", "Pt.", "Sob.", "Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"];
    var monthNames = ["Sty.", "Lut.", "Mar.", "Kwi.", "Maj", "Cze.", "Lip.", "Sie.", "Wrz.", "Paź.", "Lis.", "Gru.", "Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"];

And if this can help I've found some resorces:
official calendar card uses translations and internal HA names for weekdays and months
calendar Screenshot_2020-10-13 Przegląd - Home Assistant

and this custom card uses translations (but I don't have any compatible eqipment with this integration…):
https://github.com/denysdovhan/vacuum-card/
I'm not programmer, but I think it has nearly ready-made localization mechanism.

Translated version looks like this (I've done changes directly in .js)
PL_Screenshot_2020-10-13 Przegląd - Home Assistant
or
PL2_Screenshot_2020-10-13 Lustro - Home Assistant

breti commented

Indeed. Localized day and month names would be great.

Similiar project uses localized texts, so maybe this can help?
https://github.com/tomasrudh/analogclock

that project doesn't show the text without the clock.. My clock has a size of 1px and display's the text as I like that better.. using 2 different cards, one for the date and one for the time.

Schermopname (9)

the other project uses a very simple localisation method.. it basicely uses the HASS language for localisation

      var locale = hass.language;
      if (config.locale) locale = config.locale;

maybe this helps? would be great!
or maybe there is a better way to achieve what I did here.. I just started with HA so I have no clue ;-)

@Obliviant
This project is closed forever
https://www.home-assistant.io/blog/2021/01/06/release-20211/#in-memoriam-of-villhellm

Everyone, who is reading this can help Villhellm's family
https://gofund.me/939d8778

The only way to continue project is fork and active developing…

breti commented

I've forked Villhellm's project and added locale support: https://github.com/breti/lovelace-intl-clock-card