tc39 / proposal-intl-displaynames-v2

Intl DisplayNames API V2
https://tc39.es/proposal-intl-displaynames-v2/
MIT License
23 stars 3 forks source link

Input conversion for language tags inconsistent with CanonicalizeLocaleList #7

Closed FrankYFTang closed 3 years ago

FrankYFTang commented 4 years ago

Moved from https://github.com/tc39/proposal-intl-displaynames/issues/71 of v1 repo

anba commented on May 18 Intl.DisplayNames.prototype.of was recently (#67) changed to use plain ToString to convert the input. This makes Intl.DisplayNames inconsistent with CanonicalizeLocaleList, which only allows String and Object inputs to avoid accepting NaN as "nan".

js> new Intl.DisplayNames("en", {type: "language"}).of(NaN) "Min Nan Chinese" But we didn't care about this case anymore when specifiying Intl.Locale:

js> new Intl.Locale("und", {language: NaN}).toString() "nan" so maybe unconditionally calling ToString is okay. We should just make sure everybody is on board with this decision.

FrankYFTang commented 3 years ago

So the handling of NaN in of() is the same as the language option in Intl.Locale now. Close this issue.