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

use Intl.Locale for langneg #602

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ImUrX
Copy link

@ImUrX ImUrX commented Dec 30, 2022

Requires fixing some test errors

Copy link
Member

@eemeli eemeli left a comment

Choose a reason for hiding this comment

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

The test errors seem rather significant here, as they're changing the behaviour of the locale matching. Given the different treatment of subtags like macos and ca-japanese in our locale.ts and the standard Intl.Locale, I'm not sure that these are easily reconcilable without some observable changes.

Effectively, this is pointing out that our current understanding of locale tags is nonstandard, and that's a bit of a problem.

I wonder if we could use Intl.Locale for matching on language, region & script, and do something else for the rest?

@ImUrX
Copy link
Author

ImUrX commented Jan 3, 2023

Yes as you can see I handle the private-usage part by just reading the last subtag (because its always the last one), what should I do?

@ImUrX
Copy link
Author

ImUrX commented Jan 3, 2023

I also personally ended up using a ponyfill of the Intl.LocaleMatcher standard proposal in my code.

@eemeli
Copy link
Member

eemeli commented Jan 3, 2023

Yes as you can see I handle the private-usage part by just reading the last subtag (because its always the last one), what should I do?

I see that. Hmmm. Could you make use of the normalization done in the baseName? As in, split it by - and compare the parts for each locale? That might allow for the implementation change to be considered a relaxation of the variant regexp.

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