Skip to content

Commit 93d7348

Browse files
committed
handle characters with accent marks
1 parent 809debc commit 93d7348

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/renderer/store/modules/profiles.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,15 @@ const getters = {
3838
},
3939
}
4040

41+
const collator = new Intl.Collator('en', {
42+
caseFirst: 'upper',
43+
sensitivity: 'case'
44+
})
45+
4146
function profileSort(a, b) {
4247
if (a._id === MAIN_PROFILE_ID) return -1
4348
if (b._id === MAIN_PROFILE_ID) return 1
44-
const aNameLower = a.name.toLowerCase()
45-
const bNameLower = b.name.toLowerCase()
46-
if (aNameLower < bNameLower) return -1
47-
if (aNameLower > bNameLower) return 1
48-
// Case-insensitive names are equal, use case-sensitive comparison as tiebreaker.
49-
if (a.name < b.name) return -1
50-
if (a.name > b.name) return 1
51-
return 0
49+
return collator.compare(a.name, b.name)
5250
}
5351

5452
const actions = {

0 commit comments

Comments
 (0)