Merge pull request #2483 from github/koesie10/fix-locale-compare
Fix remaining `localeCompare` without locale set
This commit is contained in:
@@ -195,7 +195,8 @@ export function compareInputOutput(a: string, b: string): number {
|
|||||||
|
|
||||||
// If either one is unknown, it is sorted last
|
// If either one is unknown, it is sorted last
|
||||||
if (aIndex === -1 && bIndex === -1) {
|
if (aIndex === -1 && bIndex === -1) {
|
||||||
return a.localeCompare(b);
|
// Use en-US because these are well-known strings that are not localized
|
||||||
|
return a.localeCompare(b, "en-US");
|
||||||
}
|
}
|
||||||
if (aIndex === -1) {
|
if (aIndex === -1) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -94,8 +94,9 @@ export function compareRepository(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall back on name compare
|
// Fall back on name compare. Use en-US because the repository name does not contain
|
||||||
return left.fullName.localeCompare(right.fullName, undefined, {
|
// special characters due to restrictions in GitHub owner/repository names.
|
||||||
|
return left.fullName.localeCompare(right.fullName, "en-US", {
|
||||||
sensitivity: "base",
|
sensitivity: "base",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user