-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Localize times #13489
Localize times #13489
Conversation
In master I see "2020-02-04 16:19" right now, which is ISO format; both in German and in English. I suppose that works in every language, but indeed it seems fine to actually localize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good, thanks! Please remember to add a Closes # still, when the tests come back.
if (pos !== -1) | ||
string = string.substring(0, pos); | ||
return string.replace('T', ' '); | ||
moment.locale(cockpit.language); // HACK: when done at the top of the file, c.language is undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should rather live in pkg/systemd/overview.jsx . @allisonkarlitskaya needs that for PR #13473 as well.
37a4c31
to
7f03be9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, thanks! I suppose this will fail on -distropkg, though.
7f03be9
to
8a5f68b
Compare
Sorry if this is not the appropriate place to ask, but is it possible to have the language set to en_us but with a 24 hour format? How? |
@PabloGrok : You'd need to pick a locale with 24 hour format, perhaps en_GB? |
But I don't want British idioms in the UI. Shouldn't time formats be decoupled from locales? |
Unfortunately browsers don't have the fine-grained locale configuration like Linux has ( |
Additionally, the first day of the week is different in various places.
And either we're assuming English means US and have German incorrect, or we (or PF) hardcode the first day of the week as Sunday: PatternFly has a
|
@garrett : Indeed -- eww, that sucks. Standard Unix/Linux locale information has had that piece of information forever:
However, I didn't find anything in Intl which would expose that piece of information to JS. There is a JS standard issue about this very topic: tc39/ecma402#6 but it has been open for 6 years now (but there is some progress). So I'm afraid right now the only thing which we can do is to keep a copy of that information in our pkg/lib. I'll look into it. |
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/weekInfo would be that, but it doesn't work in Firefox, Chromium, nor node.js. |
I sent PR 16587 to at least fix this for most users. |
Fixes #8583
I haven't found any other place, where the format would not be localized. If you find something, please point it out, and I'll fix it out.
The only other place related to time, that should be localized, are calendars:
(names of days, on which day week starts... - this can be done with setting up
language
but it requires to import all locale files - which cannot be automated... But there are also other options, so I just plan to open issue for that and take a look at it separately).I am not sure about that change on the overview page. It seems so obvious that I doubt it was not purposely that way? Now looks like this in English and is localized:
Is that right?
Likely breaks tests, so spinning them out