Description
The PR #420 tries to add a first few functions to the registry.
Since this is the first time we try to put something in the registry, it is a learning experience.
I've noticed some areas that would benefit from a discussion, can be used to derive more generic guidelines,
or update the registry description, or need more explaining.
So here there are, captured with not obvious order:
Registry improvements
I found that regexp / list of value mechanism is not powerful enough to describe all things we might want, especially for input.
ISO 8601 is one example: https://en.wikipedia.org/wiki/ISO_8601
And, as Addison noted, ISO8601 and RFC3339 are in the process of being extended to support of Temporals.
One can also imagine phone numbers, emails, urls, measurement, intervals, time duration etc.
Even the describing numbers is difficult. The current regex does not allow certain things that one would
reasonably expect, and allows certain things that one might find unusual.
So the current regex in patterns are to be seen as placeholders until we have something better.
List of values are also not enough, several comments were about the 20+ options in the number formatting
(maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits)
One idea: probably a minimal option would be an URL?
<pattern id="interval" url="https://url-to-detailed-spec"/>
Another idea: use XML Schema instead of DTD.
It is a bit richer in datatypes, and can also define new types.
But it is probably still not powerful enough.
Options left out
The first batch is strongly influenced by the ECMAScript Intl
, intersected with what ICU can do today,
and also keeping the back of the head what current OS APIs can do.
Some areas of ECMAScript were left out, as they don't seem to have a be too portable:
- The locale matching algorithm to use:
localeMatcher
- The format matching algorithm to use:
formatMatcher
- Whether to use 12-hour time (as opposed to 24-hour time):
hour12
. It looks like it overlaps withhourCycle
?
Experimental options: left out
We left out all the Experimental options in Intl.NumberFormat
:
signDisplay@negative
, useGrouping
, roundingMode
, roundingPriority
, roundingIncrement
, trailingZeroDisplay
Functions left out
For now we ignored the functions that are ICU only or ECMAScript only.
list formatting : ECMAScripy only
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat
relative time formatting : ECMAScripy only
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat
spellout : ICU only
duration : ICU only
ICU has relative time and list formatting, but not in MessageFormat.
Adding function wrappers to have them in MessageFormat 2 is a simple.
In fact list formatting is already in the ICU4J implementation, in a unit test.
It took about 40 lines of code.