Skip to content
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

Merged
merged 1 commit into from
Sep 12, 2018

Conversation

samwilson
Copy link
Member

Also add US English as an option, so that the old default can
still be selected if desired.

Also add US English as an option, so that the old default can
still be selected if desired.

Bug: https://phabricator.wikimedia.org/T201704
Copy link
Member

@MusikAnimal MusikAnimal left a 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');
Copy link
Member

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.

Copy link
Member Author

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.)

@samwilson
Copy link
Member Author

Oh right! I thought it was across the board for en! :) But you're right.

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.

@samwilson samwilson merged commit dd30233 into master Sep 12, 2018
@samwilson samwilson deleted the date-format-T201704 branch September 12, 2018 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants