Closed
Bug 1329589
Opened 8 years ago
Closed 8 years ago
[DateTimePicker] Set calendar variables for date picker using Intl.getCalendarInfo
Categories
(Toolkit :: UI Widgets, defect)
Toolkit
UI Widgets
Tracking
()
RESOLVED
FIXED
mozilla54
Tracking | Status | |
---|---|---|
firefox54 | --- | fixed |
People
(Reporter: scottwu, Assigned: scottwu)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Bug 1287503 has made locale dependent calendar information such as first-day-of-week and weekends available. The date picker should make use of the Intl.getCalendarInfo API to improve l10n support.
Comment hidden (mozreview-request) |
Assignee | ||
Updated•8 years ago
|
Attachment #8829339 -
Flags: review?(mconley)
Attachment #8829339 -
Flags: review?(gandalf)
Assignee | ||
Comment 3•8 years ago
|
||
mozreview-review |
Comment on attachment 8829339 [details]
Bug 1329589 - Set calendar variables for date picker using Intl.getCalendarInfo
https://reviewboard.mozilla.org/r/106456/#review107418
::: toolkit/content/widgets/datetimepopup.xml:197
(Diff revision 1)
> + <method name="getCalendarInfo">
> + <parameter name="locale"/>
> + <body><![CDATA[
> + const l10n = {};
> + const mozIntl = Components.classes["@mozilla.org/mozintl;1"].getService(Components.interfaces.mozIMozIntl);
> + mozIntl.addGetCalendarInfo(l10n);
gandalf: I saw that you've used mozIntl.addGetCalendarInfo(Intl) to add the method to `Intl`, but I wonder if it's okay to mutate `Intl`?
Comment 4•8 years ago
|
||
mozreview-review |
Comment on attachment 8829339 [details]
Bug 1329589 - Set calendar variables for date picker using Intl.getCalendarInfo
https://reviewboard.mozilla.org/r/106458/#review107670
Seems okay, but see my suggestion below.
::: toolkit/content/widgets/datetimepopup.xml:192
(Diff revision 1)
> + <method name="getCalendarInfo">
> + <parameter name="locale"/>
> + <body><![CDATA[
> + const l10n = {};
> + const mozIntl = Components.classes["@mozilla.org/mozintl;1"].getService(Components.interfaces.mozIMozIntl);
> + mozIntl.addGetCalendarInfo(l10n);
> + return l10n.getCalendarInfo(locale);
> + ]]></body>
> + </method>
> + <method name="parseCalendarInfo">
> + <parameter name="calendarInfo"/>
Out of curiosity, why is this split into two steps? Do we expect to call getCalendarInfo and not pass immediately to parseCalendarInfo somewhere?
If not, I'm fine with having a helper function for getting the calendar info, but perhaps we can just have callers call `getCalendarInfo(locale)` and get back what you're returning from `parseCalendarInfo`?
Attachment #8829339 -
Flags: review?(mconley) → review+
Comment hidden (mozreview-request) |
Assignee | ||
Comment 6•8 years ago
|
||
mozreview-review-reply |
Comment on attachment 8829339 [details]
Bug 1329589 - Set calendar variables for date picker using Intl.getCalendarInfo
https://reviewboard.mozilla.org/r/106458/#review107670
> Out of curiosity, why is this split into two steps? Do we expect to call getCalendarInfo and not pass immediately to parseCalendarInfo somewhere?
>
> If not, I'm fine with having a helper function for getting the calendar info, but perhaps we can just have callers call `getCalendarInfo(locale)` and get back what you're returning from `parseCalendarInfo`?
My initial thought was to make them two functions before they do different things, but I can see that combining them makes sense because I don't expect getCalendarInfo to be used anywhere else.
Comment 7•8 years ago
|
||
mozreview-review |
Comment on attachment 8829339 [details]
Bug 1329589 - Set calendar variables for date picker using Intl.getCalendarInfo
https://reviewboard.mozilla.org/r/106458/#review107926
lgtm!
Attachment #8829339 -
Flags: review?(gandalf) → review+
Assignee | ||
Comment 8•8 years ago
|
||
Thanks! Checking it in.
:gandalf, I do have a question about testing. I'm working on adding browser chrome tests in Bug 1328219, and I wonder what would be a good way test for different UI locales?
Flags: needinfo?(gandalf)
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/e4754459cae8
Set calendar variables for date picker using Intl.getCalendarInfo r=gandalf,mconley
Keywords: checkin-needed
Comment 10•8 years ago
|
||
You can't do too much. As a rule of thumb, try to write tests that do not rely on any particular values returned from intl functions.
Where you do need some bits, test for 2 locales that have different values, maybe 'de' and 'ar'?
This would cover you for bidi and l10n.
Flags: needinfo?(gandalf)
Comment 11•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in
before you can comment on or make changes to this bug.
Description
•