GirkovArpa/temps-lite

Date formats

papioara opened this issue · 11 comments

This is less an issue, but rather a feature request: Is there a way of adjusting different date formats depending on which language temps-lite is run in? As of now, temps-lite just always uses the English one like tue, february 16. In Germany, however, it would be di, 16. februar - with a dot after the date - for example.
Would that be complicated? If not, and it can be changed, I will inform about date formats in Italy, Spain, Holland and France, to be on the safe side, and if a list should be necessary like with the months and weekdays.

It would be kind of complicated at the moment, but as soon as this patch drops, we won't need to translate anything anymore and the dates will be automatically formatted correctly per locale 😃

Cool! let's wait and see what it does...

@papioara It turned out to be simpler than I thought 😄 I added the functionality here. I've added this to the .json files:

"CURRENT-DATE-FORMAT": "WEEKDAY, MONTH DAY",

That's for English, for example. And all the others, except for German, which I took the liberty of matching to your example:

"CURRENT-DATE-FORMAT": "WEEKDAY, DAY. MONTH",

So at the moment all of the languages use the same format, except German.

Wonderful! I just tested it, and it looks very good now. Tomorrw I will enquire a little about french, spanish, dutch and italian date formats. If I can edit the jsons, I will modify them accordingly, and then we are complete as far as I can see it at the moment. Almost all major West European languages are covered already. Scandinavia is still missing, but I don't speak these languages unfortunately, but I have finnish and swedish friends whom I could ask for help. And then Eastern Europe of course: Polish, Czech, Russian and the like. Would be great to even have more languages, wouldn't it?

The more languages, the better 🙂

I have looked into date formats today for Spanish, Italian, French and Dutch. Dutch is simple, but the three first ones are more complex: they have exceptions for the general rule on the first day of the month. In French, for instance you say 'samedi 2 février', but 'vendredi février 1er' with rhe e and r raised. Is there a way to handle this? Or shall we just wait for the Sciter patch?

I believe the internet standard is simpler, based on how JavaScript does it. Run the following code in your browser's console window, for example:

(() => {
  const date = new Date();
  date.setDate(1);
  date.setMonth(1);
  const output = date.toLocaleString('fr-FR', { 
    weekday: 'short', 
    month: 'long', 
    day: 'numeric'
  });
  console.log(output);
})();

I see it print "lun. 1 février" instead of "lun. 1er février".

However, if you think another format is preferable, I can most probably make the formatting function capable of handling all of them if you share enough examples to encompass all the variations.

Or shall we just wait for the Sciter patch?

I believe the updated Sciter will format dates exactly the same as JavaScript.

Thank you for these interesting pieces of information. The thing is utlimately a matter of principle and worth discussing at least. There is ISO 8601 trying to establish a world-wide standard. And there is an interesting Wikipedia article (not comprehensive, though) about international time notations. And then there is how people in these countries use to speak about date and time in everyday life. And this is - seeing from the languages I speak - yet another thing, because it is based on tradition.

Back to temps-lite: it feels like a smart, good-looking little app which tries to speak your language the way you are used to. The decriptions of the weather use the terms generally used in meteorological contexts. OpenWeather does a good job here.
My personal view (not necessarily aspiring to be the one and only approach) would be: temps-lite should try and do so with date and time, too. Of course, if programming this gets too complicated, then I also would say that it is not indispensable. But it would be nice to give it a try, even if it means some manual editing of files and more. I would be happy to help with it at least, at least with what I have in stock :-).

What would you think about it?

I think that is a very good idea, and most probably not too complicated. It makes sense to me because as you say, 1er is natural for French (premier?), and the English equivalent is 1st (first), so not even the English display uses the colloquial phrasing.

Closing since support for this functionality has been added.