Added lang store

This commit is contained in:
Alexis
2025-03-20 15:44:11 +01:00
parent e70841e7b4
commit 99aa951d47
7 changed files with 91 additions and 16 deletions

View File

@@ -6,7 +6,6 @@ import type { Head } from '@/types/Head';
interface Props {
title: string
head?: Head
lang?: Language
}
const { title, head } = Astro.props;
@@ -17,6 +16,15 @@ const lang = getLangFromUrl(Astro.url) || defaultLang;
<!doctype html>
<html lang={lang}>
<head>
<script>
import { setLang } from "@/i18n/store";
import { defaultLang, type Language } from "@/i18n/ui";
import { getLangFromUrl } from "@/i18n/utils";
const currentLang: Language = getLangFromUrl(new URL(window.location.href)) || defaultLang;
setLang(currentLang || defaultLang);
</script>
<meta charset="UTF-8" />
<meta name="author" content="Alexis Pelé" />
{head?.description && <meta name="description" content={head.description} /> }
@@ -43,7 +51,7 @@ const lang = getLangFromUrl(Astro.url) || defaultLang;
{head?.image && <meta property="twitter:image" content={head.image} />}
<link rel="stylesheet" href="/leaflet/leaflet.css" rel="preload" />
<script is:inline src="/leaflet/leaflet.js"></script>
<script is:inline src="/leaflet/leaflet.js" />
<script is:inline type="text/javascript" src="/js/leaflet-zoomify.min.js"></script>