Any chance that user will be allowed to select international time and date formats in the web-ui? Well, as I think about it, I realize my main concern is the time format, i.e. the 24 hour clock, but while I’m at it I might as well mention dates. And first day of the week conventions (should they ever become relevant).
I don’t want to add a switch in the Setting page just for this. Ideally the web GUI should be able to detect the locale and set to the correct format automatically, but it doesn’t appear that go provides a method for doing this.
So what does that mean? No, but yes, but no?
If there will be only one fixed format, I’d suggest that this should be an internationally recognized format, such as ISO 8601.
Sorry for reviving this old thread, but this is still very relevant, as well as general translation support of the web UI.
As far as I know, the Browser only sends an
Accept-Language header, which could theoretically be parsed in Go using golang.org/x/text/language.ParseAcceptLanguage. This in turn theoretically could be used with golang.org/x/text/date, which seems to not be done yet (it doesn’t expose any public methods).
date.toLocaleString() - this could be done easily by e.g. using
<span format-time>2021-06-08T10:45:55.335Z</span> and then later
[...document.querySelectorAll("[format-time]")].forEach(el => el.textContent = new Date(el.textContent).toLocaleString());
This would require general translation support though, as “This backup was created on letzten Montag” doesn’t really read too well.
Is the web UI souce-available somewhere so I could maybe help out with that?