Investigate replacing mozIntl.getDisplayNames with Intl.DisplayNames
Categories
(Core :: Internationalization, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox94 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
Details
Attachments
(6 files, 2 obsolete files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Support for date-time types was removed from the Intl.DisplayNames
proposal (https://github.com/tc39/proposal-intl-displaynames/pull/63), but will reappear at some later stage. The Intl.DisplayNames
implementation which landed in bug 1557727 has an option to re-enable date-time types, though. We could use this enhanced Intl.DisplayNames
version to replace the current callers to the Intl.getDisplayNames
function (which is also non-standard).
This will result in a slight change of behaviour, because Intl.getDisplayNames
' "short" style is mapped to CLDR's "abbreviated" style, whereas Intl.DisplayNames
' "short" style is mapped to CLDR's "short" style.
For example the display name for Sunday will change as follows:
Locale | CLDR abbreviated | CLDR short |
---|---|---|
English | Sun | Su |
Polish | niedz. | nie |
German | So | So. |
French | dim. | di |
Spanish | dom. | DO |
Assignee | ||
Comment 1•4 years ago
|
||
Expose Intl.DisplayNames
to mozIntl
. The exposed Intl.DisplayNames
version
supports date-time types, which have been removed from the spec proposal, but
may be re-enabled at some point in the future.
The existing getDisplayNames
WebIDL function had to be renamed, because WebIDL
doesn't allow specify an attribute named DisplayNames
and a separate function
called getDisplayNames
.
Drive-by change:
- Removed an out-dated comment in "mozIMozIntlHelper.idl" which mentioned calling
addDateTimeFormatConstructor
twice throws an error.
Assignee | ||
Comment 2•4 years ago
|
||
Update callers to the previous mozIntl.getDisplayNames
function to use
mozIntl.DisplayNames
.
There's a slight change in behaviour:
The "short"
style for mozIntl.getDisplayNames
was mapped to what CLDR calls
the "abbreviated"
style, whereas mozIntl.DisplayNames
's "short"
style is
mapped to CLDR's "short"
style. (UDAT_STANDALONE_SHORT_WEEKDAYS
uses
CLDR's "abbreviated"
style, whereas UDAT_STANDALONE_SHORTER_WEEKDAYS
uses
CLDR's "short"
style.)
That means for example Polish "niedziela" (Sunday) is now displayed as "nie",
but was previously displayed as "niedz.".
Depends on D76114
Assignee | ||
Comment 3•4 years ago
|
||
Update the documention to mention Intl.DisplayNames
instead of
Intl.getDisplayNames
.
Depends on D76115
Assignee | ||
Comment 4•4 years ago
|
||
Rewrite mozIntl.getDisplayNames
to use mozIntl.DisplayNames
, so we can use
it for intlUtils.getDisplayNames
, which doesn't have direct access to
mozIntl.DisplayNames
.
This change will allow to remove getDisplayNames
from SpiderMonkey in a later
patch in this stack.
Depends on D76116
Assignee | ||
Comment 5•4 years ago
|
||
This function is no longer needed after part 4.
Depends on D76117
Assignee | ||
Comment 6•4 years ago
|
||
Drive-by change:
- Reorder constructors to be in alphabetical order.
Depends on D76118
Assignee | ||
Comment 7•4 years ago
|
||
Add Intl.Locale
to mozIntl.Locale
, so all constructor functions from Intl
are also directly available on mozIntl
.
Also update some places to use Intl.Locale
instead of performing manual
language tag parsing. (Intl.Locale
doesn't provide an accessor for
variants
subtags, so a bit of manual parsing is still necessary.)
Depends on D76119
Assignee | ||
Comment 8•4 years ago
|
||
Added some draft patches to show how this could be implemented.
Updated•4 years ago
|
Comment 9•4 years ago
|
||
Those patches look great! Thank you so much Anba!
Added some draft patches to show how this could be implemented.
I think you did a bit more than that ;) What's missing to make them ready to review?
Assignee | ||
Comment 10•4 years ago
|
||
(In reply to Zibi Braniecki [:zbraniecki][:gandalf] from comment #9)
What's missing to make them ready to review?
- Getting approval that using CLDR "short" instead of "abbreviated" style is okay for the date-time picker element (
<input type="date">
). The change is also visible for theabout:protections
page, but I guess that one isn't as user-visible as the date-time picker (, because I assume not that many users visitabout:protections
.)- FWIW Chrome already seems to use CLDR "short" style for their date-time picker element.
- And we want to make sure that supporting date-time display names is still on track for the
Intl.DisplayNames
proposal. I think that's still the plan, but you probably know more about the current state of the proposal than me. :-)
Comment 11•4 years ago
|
||
Getting approval that using CLDR "short" instead of "abbreviated" style is okay for the date-time picker element (<input type="date">). The change is also visible for the about:protections page, but I guess that one isn't as user-visible as the date-time picker (, because I assume not that many users visit about:protections.)
Yes. I filed https://github.com/tc39/proposal-intl-displaynames/issues/74 and let's see what the community says.
I prefer abbreviated for English, but it's not a strong opinion.
If ECMA402 will not want to support it, we still may want to consider adding it for Mozilla-only use or switch to short
.
And we want to make sure that supporting date-time display names is still on track for the Intl.DisplayNames proposal. I think that's still the plan, but you probably know more about the current state of the proposal than me. :-)
Filed https://github.com/tc39/proposal-intl-displaynames/issues/75
I'd also like to consider, in case ECMA402 cannot commit, to expose those two as Mozilla-only. We know we need to use them, and extending Intl API for Mozilla use seems easier and lower overhead than implementing separate ICU callsites for mozIntl.
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 12•3 years ago
|
||
As a non-standard extension, add the "abbreviated" style to be able to select
CLDR's abbreviated format. This style is used by the DateTimePicker component
for weekdays.
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Comment 13•3 years ago
|
||
Comment 15•3 years ago
|
||
Backed out for causing failures on test_intlUtils_getDisplayNames.html. CLOSED TREE
Backout link : https://hg.mozilla.org/integration/autoland/rev/d57b281d9a4f46f5098293771dce49e0585d1ca1
Push with failures : https://treeherder.mozilla.org/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception%2Crunnable&revision=eaff696ed6a6c3354707dd9b25f76f39a26ef6ca&selectedTaskRun=dEG0pQTKQgi8kH_i1ELKEA.0
Link to failure log : https://treeherder.mozilla.org/logviewer?job_id=351463517&repo=autoland&lineNumber=2949
Assignee | ||
Updated•3 years ago
|
Comment 16•3 years ago
|
||
Comment 17•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7f387112b4a5
https://hg.mozilla.org/mozilla-central/rev/d8caab702d3f
https://hg.mozilla.org/mozilla-central/rev/1670460a5435
https://hg.mozilla.org/mozilla-central/rev/f5b3ca80c125
https://hg.mozilla.org/mozilla-central/rev/96418f6e99c7
https://hg.mozilla.org/mozilla-central/rev/18fdaf3f7de5
Description
•