inject static meta tags for each language

This commit is contained in:
vcoppe
2024-08-16 12:25:24 +02:00
parent 3bc9ac4639
commit fa30739fd0
7 changed files with 75 additions and 117 deletions

View File

@@ -1,23 +0,0 @@
<script lang="ts">
import { locale, _ } from 'svelte-i18n';
import { page } from '$app/stores';
import { languages } from '$lib/languages';
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { base } from '$app/paths';
$: if ($page.params.language === '' && $locale !== 'en') {
locale.set('en');
} else if ($page.params.language) {
let lang = $page.params.language.replace('/', '');
if ($locale !== lang) {
if (languages.hasOwnProperty(lang)) {
locale.set(lang);
} else if (browser) {
goto(`${base}/404`);
}
}
}
</script>
<slot />