Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Normative: Add maximize/minimize methods #30

Merged
merged 1 commit into from
Apr 27, 2018
Merged

Normative: Add maximize/minimize methods #30

merged 1 commit into from
Apr 27, 2018

Conversation

littledan
Copy link
Member

These methods add and remove likely subtags. UTR 35 defines the relevant
algorithms in exactly the way we'd need here, so this patch just references
that specification. We'd probably want to iterate on the details of the
normative reference when integrating into the main specification.

These methods add and remove likely subtags. UTR 35 defines the relevant
algorithms in exactly the way we'd need here, so this patch just references
that specification. We'd probably want to iterate on the details of the
normative reference when integrating into the main specification.
@littledan
Copy link
Member Author

cc @nciric @jackhorton

Copy link

@nciric nciric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change. Looks good.

@littledan littledan merged commit 70d4249 into master Apr 27, 2018
@anba
Copy link
Contributor

anba commented Apr 27, 2018

Nit: unicode.org now supports "https", so we should use it in the links.

@anba
Copy link
Contributor

anba commented Apr 27, 2018

And the leftover description for the no longer present [[LikelySubtags]] slot in https://tc39.github.io/proposal-intl-locale/#sec-intl.locale-internal-slots should be removed.

littledan added a commit that referenced this pull request Apr 27, 2018
@anba
Copy link
Contributor

anba commented Apr 27, 2018

Do we care about the cases where CLDR / UTR 35 canonicalization is different from IANA / RFC5646 canonicalization?

For example CLDR canonicalizes "ces" to "cs" here, which means new Intl.Locale("ces").maximize().toString() probably (?) returns "cs-Latn-CZ" here. But according to IANA "ces" is not a recognized language subtag to begin with, which in turn means new Intl.Locale("ces").toString() returns only "ces".

@littledan
Copy link
Member Author

@anba Is there a UTR 35 algorithm we can reference for canonicalization?

@anba
Copy link
Contributor

anba commented Apr 27, 2018

No idea.

@zbraniecki
Copy link
Member

@anba - I'm confused. If CLDR canonicalizes ces to cs, new Intl.Locale("ces").toString() should already return cs.

littledan added a commit that referenced this pull request Apr 28, 2018
@littledan
Copy link
Member Author

We're keeping around data about things like what's the default calendar for a locale, and exposing it in Intl.DateTimeFormat.prototype.resolvedOptions(). I wonder if we should expose this in maximize() and remove it in minimize() as well.

@anba
Copy link
Contributor

anba commented May 2, 2018

@zbraniecki IIUC CLDR doesn't use plain BCP 47 per RFC 5646, but instead defines Unicode Language Identifier which are based on BCP 47. Whereas ECMA-402 uses plain BCP 47 per RFC 5646, including the canonicalization defined in RFC5646 which takes only the data from the IANA language tag registry and no other sources. CLDR canonicalization seems to use the data from common/supplemental/supplementalMetadata.xml. Oh, and ICU's uloc_canonicalize is still a bit different than IANA or CLDR canonicalization, because it also attempts to recognize input from outer sources like POSIX or .NET, see http://userguide.icu-project.org/locale#TOC-Canonicalization, this is for example visible for Intl.getCanonicalLocales("es-ES-preeuro") in implementations which directly call into ICU. So, this is all a bit messy...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants