ResolvedLocale locale string manipulation is confusing and inconsistent #872
Labels
c: spec
Component: spec editorial issues
s: help wanted
Status: help wanted; needs proposal champion
Small
Smaller change solvable in a Pull Request
Milestone
ResolveLocale strives to output a record in which the string locale includes "-u-" Unicode locale extension sequence data from the matched requested locale as filtered by relevantExtensionKeys and superseded by options, but it (and implementations) do a poor job of handling keys with multiple representations for the same value data.
Examples
Calendar
"islamic-civil" vs. "islamicc"
GraalJS and SpiderMonkey seem to normalize the value from the requested locale and the value from options before doing anything with either, such that
{ calendar: "islamicc" }
is treated as a non-override of both "-u-ca-islamic-civil" and "-u-ca-islamicc". V8 seems to normalize only the former before comparison, such that{ calendar: "islamicc" }
is treated as overriding both "-u-ca-islamic-civil" and "-u-ca-islamicc". And JSC seems to not normalize the value from options at all, such that{ calendar: "islamicc" }
overrides any value in the requested locale and also survives intoresolvedOptions()
output.I prefer the GraalJS/SpiderMonkey behavior.
Numeric collation
"true" vs. empty string
All implementations agree on output from
resolvedOptions()
, and that behavior is expected. As for the locale string, GraalJS overrides it when options provides any value at all, V8 always preserves it regardless of options, and JSC and SpiderMonkey preserve it if and only if options provides no value or provides a truthy value.I prefer the JSC/SpiderMonkey behavior.
Recommendations
I would like to update the spec to produce behavior like that of SpiderMonkey, normalizing values before comparing them to determine if options constitutes an override and therefore necessitates a removal from the resolved locale string.
The text was updated successfully, but these errors were encountered: