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

Check whether the locale data should use locale aware sorting #2905

Closed
ST-DDT opened this issue May 16, 2024 · 6 comments · Fixed by #2948
Closed

Check whether the locale data should use locale aware sorting #2905

ST-DDT opened this issue May 16, 2024 · 6 comments · Fixed by #2948
Assignees
Labels
c: infra Changes to our infrastructure or project setup c: locale Permutes locale definitions p: 1-normal Nothing urgent
Milestone

Comments

@ST-DDT
Copy link
Member

ST-DDT commented May 16, 2024

We should check whether the locale data should be sorted with their original locale in mind.

.sort() as T

@ST-DDT ST-DDT added p: 1-normal Nothing urgent c: locale Permutes locale definitions c: infra Changes to our infrastructure or project setup labels May 16, 2024
@ST-DDT ST-DDT added this to the v9.0 milestone May 16, 2024
@ST-DDT
Copy link
Member Author

ST-DDT commented May 16, 2024

Blocked by the initial sorting of the locale data after #2265

@ST-DDT ST-DDT added the s: on hold Blocked by something or frozen to avoid conflicts label May 16, 2024
@xDivisionByZerox
Copy link
Member

Potentially relevant implementation details in #2265 (comment).

Same as with the language aware letters. I can extend the previos compare function to be numeric aware:

const arr = ['B', 'A', 'Å', 'Å9', 'Å11']
const sorted = arr.toSorted((a,b) => a.localeCompare(b, undefined, { numeric: true }));
console.log(sorted); // ['A', 'Å', 'Å9', 'Å11', 'B']

@matthewmayer
Copy link
Contributor

i tried a draft implementation at #2906 - this is imperfect, but gives you an idea of the scope of the likely changes if this is done.

@ST-DDT ST-DDT linked a pull request May 17, 2024 that will close this issue
@xDivisionByZerox xDivisionByZerox added the s: needs decision Needs team/maintainer decision label Jun 11, 2024
@ST-DDT ST-DDT removed s: on hold Blocked by something or frozen to avoid conflicts s: needs decision Needs team/maintainer decision labels Jun 13, 2024
@ST-DDT
Copy link
Member Author

ST-DDT commented Jun 13, 2024

Team Decision

The current locale unaware sorting is good enough/the best approach for our contributor experience.

We will add a comment to the script similar to this one:

We cannot sort this locale aware, as the sort order is not stable within node versions #2905

// sort entries alphabetically
.sort() as T

@ST-DDT ST-DDT assigned ST-DDT and unassigned matthewmayer Jun 13, 2024
@Shinigami92
Copy link
Member

I did some research, digged down the rabbit-hole and found a bit out about ICU

so FFR, here is a list of helpful links:

This could be used to download the icu.dat file and store it in some cached way locally and pinned for execution when sorting

However I dont have the time right now, so it is just a way and idea and up for experimental grab if someone cares 🙂

@ST-DDT
Copy link
Member Author

ST-DDT commented Jun 13, 2024

We will add a comment to the script similar to this one:

We cannot sort this locale aware, as the sort order is not stable within node versions #2905

Done:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: infra Changes to our infrastructure or project setup c: locale Permutes locale definitions p: 1-normal Nothing urgent
Projects
None yet
4 participants