-
Notifications
You must be signed in to change notification settings - Fork 18
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
PartitionDurationFormatPattern: ListFormat "type" and "style" #109
Comments
The type should be "unit" and the length should be the same as the length of the time unit display names. If this is not specified in the spec, then it should be. |
what do you mean about this here? How about the following mapping DurationFormat style => ListFormat style The problem with this approach is if we have any of the "hours", "minutes" or "seconds" in "numeric" or "2-digit" ListFormat "long" , "short", and "narrow" may not work properly with them. because we will have the following to be formatted by the ListFormat if we have something like
if we use style "long" in ListFormat, it would be formatted as The other issue we need to considered together is what should formatToParts output for this if we decide to change the algorithm to let the ListFormat see the input as |
LGTM |
@sffc sorry, I hit my "Comment" before I complete my typing and I have to revise it. Please see the other issues I mentioned above. |
I think we should discuss the type and style of using ListFormat separately because deciding type to use "unit" is a much simpler discussion than "style" which require a lot to resolve complexity issue with the total 11 different styles framework in DurationFormat |
This spacing around individual elements is locale-specific, for example |
This is not an output that should ever be generated. Fields with the "numeric" style should go through an entirely different code path, and interpolated as a single unit into the list at the end. It should be "3 days, 02:05". |
but this issue is not just under style: "digital"
|
using type: "unit" it will generate '3 days 02:05' |
See #64 (comment) for an open discussion on this. I suggested:
|
that is already the case in the current spec and has nothing to do with the issue I mentioned in
because in there, hours, minutes, seconds, milliseconds, microseconds, and nanoseconds are all "numeric" already (by step 17-i-i of https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat and GetDurationUnitOptions ) but days (and also years, months, weeks) are still "long". |
As you might've seen in the review I made for the PR, I don't think |
Given that we are formatting a list of units, I think we should stick with the "unit" list type, and if we think the output could be improved for longer lengths, we should discuss that with CLDR. What we shouldn't do is make an arbitrary decision to use different list types based on what we think looks nicer in English. |
Alright, you have my convinced, I'll merge the PR then. |
* Normative: Pass type+style to ListFormat per discussion in #109 * fixup: [spec] `npm run build` Co-authored-by: FrankYFTang <[email protected]>
#119 Closes this one |
The internal
Intl.ListFormat
is currently created without any options, which means we default totype = "conjunction"
andstyle = "long"
.The
style
option was discussed in #14, but I don't see the approved option (option 2 - implicit pass-through) reflected in the current spec. Was this decision reverted at some point?UTS 35 has Unit Sequences (Mixed Units), which uses
<listPattern type="unit">
. Does that mean according to UTS 35, we should actually usetype = "unit"
for theIntl.ListFormat
? Or doesIntl.DurationFormat
not count as a "mixed units" use case?The text was updated successfully, but these errors were encountered: