Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: Refactor Locale and Parameter Negotiation to better align with BCP 47 #871

Merged
merged 8 commits into from
Mar 28, 2024

Conversation

gibson042
Copy link
Contributor

@gibson042 gibson042 commented Mar 1, 2024

Best reviewed commit-by-commit.

RFC 4647 section 2.3 defines "language priority list" as "a prioritized or weighted list of language ranges", and corresponds to requestedLocales in various ECMA-402 operations.
RFC 4647 section 3 differentiates "matching schemes" applying such lists against available locales into "filtering" (producing zero or more matches) and "lookup" (producing exactly one match). Language Tags and Locale Identifiers for the World Wide Web reinforces their significance ("Specifications that define operations on language tags or locale values using matching MUST specify whether the resulting language priority list contains a single result (lookup as defined in [RFC 4647]), or a possible empty set of results (filtering as defined in [RFC 4647])").

This PR incorporates those terms and refactors the algorithms to better align with BCP 47, consolidating many of them and establishing clear entry points at ResolveLocale for lookup and FilterLocales (née SupportedLocales) and filtering.

@gibson042 gibson042 requested review from ben-allen and ryzokuken March 1, 2024 03:49
@gibson042 gibson042 force-pushed the 2024-02-locale-matching branch from 3f34988 to 6aac79e Compare March 2, 2024 15:49
Copy link
Contributor

@ben-allen ben-allen left a comment

Choose a reason for hiding this comment

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

I love this -- much better documented than before. I've made some wording suggestions/tweaks, but otherwise I approve.

spec/locale-sensitive-functions.html Outdated Show resolved Hide resolved
spec/negotiation.html Outdated Show resolved Hide resolved
spec/negotiation.html Outdated Show resolved Hide resolved
spec/negotiation.html Outdated Show resolved Hide resolved
spec/negotiation.html Outdated Show resolved Hide resolved
@gibson042 gibson042 force-pushed the 2024-02-locale-matching branch from 8902e11 to 069c5f3 Compare March 28, 2024 17:27
@gibson042
Copy link
Contributor Author

@ben-allen Accepted the suggestions with a few tweaks. I'm ready to land as soon as you approve.

@gibson042 gibson042 requested a review from ben-allen March 28, 2024 17:28
Copy link
Contributor

@ben-allen ben-allen left a comment

Choose a reason for hiding this comment

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

LGTM!

@gibson042 gibson042 merged commit cad1236 into tc39:main Mar 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants