-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add ISO8601 override for English date formatting #114
Conversation
19d8187
to
61df9f1
Compare
Also add US English as an option, so that the old default can still be selected if desired. Bug: https://phabricator.wikimedia.org/T201704
61df9f1
to
4a1fec1
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.
I think we had decided we wanted ISO 8601 across the board? Personally, I'm quite happy with this PR. Certainly an improvement and it will still allow people to see formats they're used to.
There may be some other locales that don't have proper fallbacks, but at least if the fallbacks trinkle down to the source language (en
), they are left with ISO 8601, which is good :)
One small comment in Intuition.php, then all 👍 from me
@@ -40,6 +40,10 @@ public static function serviceFactory(RequestStack $requestStack, SessionInterfa | |||
$intuition = new static('grantmetrics'); | |||
$intuition->registerDomain('grantmetrics', $rootDir.'/../i18n'); | |||
$intuition->setLang(strtolower($useLang)); | |||
|
|||
// Also add US English, so we can access the locale information (e.g. for date formatting). | |||
$intuition->addAvailableLang('en-us', 'US English'); |
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 would probably call it 'English (US)'
or is there some standard I'm unaware of? Language first would make it easier to find in the language dropdown.
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 wondered about that, there is a standard but MediaWiki and Intuition don't follow it (it'd be as you say "Language (Country)", sometimes with a script in between I think; see here). We've got 'British English', 'Canadian English', and 'English' in alphabetical order (and so not near each other in the dropdown). One way to fix it would be to sort by language code, then all the Englishes would be together (we're sorting in AppExtension::getAllLangs()
).
(Also, we should make it possible to start typing and jump to anywhere in that list, or filter it; but that's another issue.)
Oh right! I thought it was across the board for Anyway, this might be better because it won't confuse non-English users so much. Maybe. I'm not sure. Oh, and this doesn't tackle the date picker at all. That's currently using the browser's locale, so I think it should be changed to use the current site-user locale (i.e. from Intuition), but I'm not quite sure off the top of my bat how to get the format that bootstrap-daterangepicker wants out of PHP's IntlDateFormatter. Anyway, it can be done in a separate patch I think, considering that it's not using the same locale at the moment. |
Also add US English as an option, so that the old default can
still be selected if desired.