Skip to content

Commit 0eb9f31

Browse files
committed
✨ feat(layouts/PageLayout): add language prop
1 parent 2b1b91e commit 0eb9f31

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/layouts/PageLayout.astro

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import Footer from "../components/Footer.astro";
55
import Navigation from "../components/Navigation.tsx";
66
77
import { defaultLang } from "../i18n/ui";
8-
import { getLanguageFromURL } from "../i18n/utils";
98
109
interface Props {
1110
title: string;
1211
icon?: string;
12+
lang?: string;
1313
navSpacing?: string;
1414
sideSpacing?: string;
1515
flex?: boolean;
@@ -20,11 +20,11 @@ const {
2020
title, icon, navSpacing = "3em",
2121
sideSpacing = "2em",
2222
flex, pfpOnNavigation = true,
23-
flexDirection = "row"
23+
flexDirection = "row", lang = (Astro.params.lang ?? defaultLang)
2424
} = Astro.props;
2525
---
2626

27-
<html lang={Astro.params.lang ?? defaultLang}>
27+
<html {lang}>
2828
<head>
2929
<meta charset="UTF-8">
3030
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -39,8 +39,8 @@ const {
3939
document.body!.classList.add(localStorage.getItem("theme") ?? "dark");
4040
</script>
4141

42-
<Navigation client:load lang={getLanguageFromURL(Astro.url) ?? "en"}
43-
showLanguageSelector={true} showProfilePic={pfpOnNavigation} />
42+
<Navigation client:load {lang} showLanguageSelector={true}
43+
showProfilePic={pfpOnNavigation} />
4444

4545
<div class="content" style=`padding-top: ${navSpacing
4646
}; display: ${flex ? "flex" : "block"

0 commit comments

Comments
 (0)