mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-19 17:22:12 +00:00
use homepage as default page
This commit is contained in:
1 parent
b38ff26a64
commit
5ed0e75427
10 files changed
+273
-283
No files matched your search
@@ -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