X-Git-Url: https://git.r.bdr.sh/rbdr/forum/blobdiff_plain/a7cf03c192470cbab13edeb1aec99e0c66dede10..HEAD:/src/lib/components/language_selector/language_selector.svelte

diff --git a/src/lib/components/language_selector/language_selector.svelte b/src/lib/components/language_selector/language_selector.svelte
index 64a4ef9..c1b8f35 100644
--- a/src/lib/components/language_selector/language_selector.svelte
+++ b/src/lib/components/language_selector/language_selector.svelte
@@ -3,16 +3,26 @@
 	import { getLangNameFromCode } from 'language-name-map';
 
 	$: namedLocales = $locales
-	  .map((code) => ({
-	    code,
-	    ...getLangNameFromCode(code)
-	  }))
-	  .sort((a, b) => a.native - b.native);
+		.map((code) => ({
+			code,
+			...getLangNameFromCode(code)
+		}))
+		.sort((a, b) => {
+			if (a.native > b.native) {
+				return 1;
+			}
 
-  let selected = $locale
+			if (a.native < b.native) {
+				return -1;
+			}
+
+			return 0;
+		});
+
+	let selected = $locale;
 
 	$: {
-	  locale.set(selected);
+		locale.set(selected);
 	}
 </script>
 
