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

Normative: Update String toLocale{Lower,Upper}Case to ResolveLocale with best-fit matching #956

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Normative: Update String toLocale{Lower,Upper}Case to ResolveLocale w…
…ith best-fit matching

Fixes #896
  • Loading branch information
gibson042 committed Jan 30, 2025
commit 70accc60ec9f1bf665c58549142f6caacc6acb1b
10 changes: 4 additions & 6 deletions spec/locale-sensitive-functions.html
Original file line number Diff line number Diff line change
@@ -79,13 +79,11 @@ <h1>
</dl>
<emu-alg>
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
1. If _requestedLocales_ is not an empty List, then
1. Let _requestedLocale_ be _requestedLocales_[0].
1. Else,
1. Let _requestedLocale_ be DefaultLocale().
1. Let _availableLocales_ be an Available Locales List which includes the language tags for which the Unicode Character Database contains language-sensitive case mappings. If the implementation supports additional locale-sensitive case mappings, _availableLocales_ should also include their corresponding language tags.
1. Let _match_ be LookupMatchingLocaleByPrefix(_availableLocales_, « _requestedLocale_ »).
1. If _match_ is not *undefined*, let _locale_ be _match_.[[locale]]; else let _locale_ be *"und"*.
1. Let _opt_ be the Record { [[localeMatcher]]: *"best fit"* }.
1. Let _relevantExtensionKeys_ be a new empty List.
1. Let _r_ be ResolveLocale(_availableLocales_, _requestedLocales_, _opt_, _relevantExtensionKeys_).
1. Let _locale_ be _r_.[[Locale]].
1. Let _codePoints_ be StringToCodePoints(_S_).
1. If _targetCase_ is ~lower~, then
1. Let _newCodePoints_ be a List whose elements are the result of a lowercase transformation of _codePoints_ according to an implementation-derived algorithm using _locale_ or the Unicode Default Case Conversion algorithm.