toLocaleLowerCase/toLocaleUpperCase should better align with the rest of ECMA-402 #896
Labels
behavior
c: text
Component: case mapping, collation, properties
normative
s: discuss
Status: TG2 must discuss to move forward
Small
Smaller change solvable in a Pull Request
String.prototype.{toLocaleLowerCase,toLocaleUpperCase} were introduced in 9ee8940 and first appeared in the second edition of ECMA-402. But toLocaleLowerCase and toLocaleUpperCase have some gratuitous differences from the preexisting String.prototype.localeCompare and Intl.Collator (the former implemented on top of the latter)—specifically,
"I".toLocaleLowerCase(["tr"])
is the dotless "ı" but"I".toLocaleLowerCase(["zzz", "tr"])
is "i", whilenew Intl.Collator(["zzz", "tr"], { sensitivity: "variant" }).compare("i", "ı")
has the same non-default behavior asnew Intl.Collator(["tr"], { sensitivity: "variant" }).compare("i", "ı")
).The second two points probably don't matter, at least with current locale data. But the first difference would surprise anyone sufficiently familiar with Intl APIs, and results in a worse end-user experience. I'd like to fix it by aligning the String methods with other Intl APIs, specifically fixing at least the first two points by replacing TransformCase's direct use of
LookupMatchingLocaleByPrefix(_availableLocales_, _noExtensionsLocale_)
(which is accidentally invalid as of f16f3ad and should be something likeLookupMatchingLocaleByPrefix(_availableLocales_, « _noExtensionsLocale_ »)
) with e.g.ResolveLocale(_availableLocales_, _requestedLocales_, _resolutionOptions_, « », _emptyLocaleData_).[[Locale]]
(which would also be a change to using the default locale rather than "und" when the first requested locale is not supported) orResolveLocale(_availableLocales_, _requestedLocales_, _resolutionOptions_, « », _emptyLocaleData_, *"und"*).[[Locale]]
(extending ResolveLocale to support a configurable default in support of preserving the current behavior).The text was updated successfully, but these errors were encountered: