-
Notifications
You must be signed in to change notification settings - Fork 107
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
BestAvailableLocale
operation requires additional clarifications/changes to handle extensions
#685
Comments
FWIW, I don't think it's a hack. It is what the operation meant to be - take LanguageIdentifier and cut from the right. It's dummy (we need data to do better), but okayish. What we didn't anticipate when desigining it is that we'll have extensions in play. No CLDR data has extensions to match on, so we can safely just remove it. |
A very basic algorithm is to first clear all extension keywords, which you can do by pulling the LanguageIdentifier out of the Locale, and then removing trailing subtags one by one. |
Completely agree. I edited the issue to better express this. |
@sffc should we clarify it in the spec? The current algo makes it seem like you should keep cutting out from the tail end one subtag after another including extensions. Which, on top of being useless, leads to invalid states of locale. |
Yep; this issue is available for anyone who wants to work on it. |
Possibly related to #213 |
Hello! I'm part of the development team of boa, where we are developing an ECMAScript engine with
Intl
support, and we have a bit of a problem with how theBestAvailableLocale
operation is described.For context, I had a discussion with some of the
icu4x
folks (boa-dev/boa#2072 (comment)) and we discovered that theBestAvailableLocale
operation, as currently described in the latest revision, tries to match invalid Unicode BCP 47 locale identifiers when executing the algorithm described.boa-dev/boa#2072 (comment)
The team kindly recommended us to treat the input
locale
as a simple Language Identifier instead, which should work but doesn't match the algorithm described. Knowing that, the question about extensions still remains, and I would like to open this issue as a request to add additional clarifications onBestAvailableLocale
. Some of our questions are:locale
as a plain Language Identifier?locale
and try to match with that, then append the removed extensions to the matched locale?Thanks!
cc @zbraniecki @sffc
The text was updated successfully, but these errors were encountered: