mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-05 18:02:55 +00:00
use homepage as default page
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import * as Select from '$lib/components/ui/select';
|
||||
import { languages } from '$lib/languages';
|
||||
import { getURLForLanguage, languages } from '$lib/languages';
|
||||
import { Languages } from 'lucide-svelte';
|
||||
import { _, locale } from 'svelte-i18n';
|
||||
|
||||
@@ -16,21 +16,6 @@
|
||||
label: languages[$locale]
|
||||
};
|
||||
}
|
||||
|
||||
function getURLForLanguage(lang?: string): string {
|
||||
let currentPath = window.location.pathname;
|
||||
let currentPathArray = currentPath.split('/');
|
||||
|
||||
if (currentPathArray.length > 1 && languages.hasOwnProperty(currentPathArray[1])) {
|
||||
currentPathArray.splice(1, 1);
|
||||
}
|
||||
|
||||
if (lang !== undefined && lang !== 'en') {
|
||||
currentPathArray.splice(1, 0, lang);
|
||||
}
|
||||
|
||||
return currentPathArray.join('/');
|
||||
}
|
||||
</script>
|
||||
|
||||
<Select.Root bind:selected onSelectedChange={(s) => goto(getURLForLanguage(s?.value))}>
|
||||
|
Reference in New Issue
Block a user