Skip to content

compactDisplay in PluralRules should only be set if notation is "compact" #1031

@FrankYFTang

Description

@FrankYFTang

I found this while I try to implement PR 989 and 1019
see https://chromium-review.googlesource.com/c/v8/v8/+/7047379

In https://github.com/tc39/ecma402/pull/1019/files we added "compactDisplay" for PluralRules.

But somehow we unconditionally call

Set pluralRules.[[CompactDisplay]] to compactDisplay.

If we look at the NumberFormat, we set it only if notation is "compact"

18. If notation is "compact", then
    a. Set numberFormat.[[CompactDisplay]] to compactDisplay.

So if we have the following code

let nf1 = new Intl.NumberFormat("fr-FR", { compactDisplay: "long" })
let nf2= new Intl.NumberFormat("fr-FR", { notation:"standard", compactDisplay: "long" })
let nf3 = new Intl.NumberFormat("fr-FR", { notation:"scientific", compactDisplay: "long" })
let nf4 = new Intl.NumberFormat("fr-FR", { notation:"engineering", compactDisplay: "long" })

let p1 = new Intl.PluralRules("fr-FR", { compactDisplay: "long" })
let p2= new Intl.PluralRules("fr-FR", { notation:"standard", compactDisplay: "long" })
let p3 = new Intl.PluralRules("fr-FR", { notation:"scientific", compactDisplay: "long" })
let p4 = new Intl.PluralRules("fr-FR", { notation:"engineering", compactDisplay: "long" })

then nf1.resolvedOptions().compactDisplay is undefined as well as nf2, nf3, nf4
but by the current spec p1.resolvedOptions().compactDisplay is somehow "long", as well as p2, p3, p4

I think compactDisplay for p1... p4 should also be undefined. It will make the v8 implementation much easier

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions