Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"where": "Standort",
"uses": "Uses (Tech Stack)",
"playlists": "Playlists",
"timeline": "Zeitstrahl",
"hotkeys": "Hotkeys",
"redirects": "Redirects",
"terminal": "Terminal",
Expand Down
1 change: 1 addition & 0 deletions src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"sitemap": "Sitemap",
"experiment": "Experiment",
"slashes": "Slashes",
"timeline": "Timeline",
"hotkeys": "Hotkeys",
"redirects": "Redirects",
"terminal": "Terminal",
Expand Down
10 changes: 6 additions & 4 deletions src/lib/utils/api.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { i18n } from '$lib/i18n/i18n.svelte';

export type DataItem = {
title?: string;
description?: string;
Expand Down Expand Up @@ -29,8 +31,8 @@ export function sortData(items: DataItem[], key: keyof DataItem, direction: Sort
}

if (typeof aValue === 'string' && typeof bValue === 'string') {
if (direction === 'asc') return aValue.localeCompare(bValue);
else return bValue.localeCompare(aValue);
if (direction === 'asc') return aValue.localeCompare(bValue, i18n.lang);
else return bValue.localeCompare(aValue, i18n.lang);
}

if (typeof aValue === 'number' && typeof bValue === 'number') {
Expand All @@ -39,8 +41,8 @@ export function sortData(items: DataItem[], key: keyof DataItem, direction: Sort
}

// fallback to string comparison
if (direction === 'asc') return String(aValue).localeCompare(String(bValue));
else return String(bValue).localeCompare(String(aValue));
if (direction === 'asc') return String(aValue).localeCompare(String(bValue), i18n.lang);
else return String(bValue).localeCompare(String(aValue), i18n.lang);
});
return filteredItems;
}
Expand Down
4 changes: 3 additions & 1 deletion src/routes/concerts/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
);

let festivals = $derived(
(data.festivals as Festival[]).sort((a, b) => b.year - a.year || a.name.localeCompare(b.name))
(data.festivals as Festival[]).sort(
(a, b) => b.year - a.year || a.name.localeCompare(b.name, i18n.lang)
)
);

function getMusicBrainzUrl(mbid: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/concerts/ConcertStats.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

return Object.entries(counts)
.map(([name, count]) => ({ name, count }))
.sort((a, b) => b.count - a.count || a.name.localeCompare(b.name));
.sort((a, b) => b.count - a.count || a.name.localeCompare(b.name, i18n.lang));
});

let maxSeen = $derived(Math.max(...artistStats.map((s) => s.count), 1));
Expand Down
2 changes: 1 addition & 1 deletion src/routes/playlists/TopArtists.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
});
return Object.entries(counts)
.map(([name, count]) => ({ name, count }))
.sort((a, b) => b.count - a.count || a.name.localeCompare(b.name));
.sort((a, b) => b.count - a.count || a.name.localeCompare(b.name, i18n.lang));
});

let maxAppearances = $derived(Math.max(...artistStats.map(s => s.count), 1));
Expand Down