From 7781c69153e3956ca14684fe9a287fbbb8a01082 Mon Sep 17 00:00:00 2001 From: Joe Carstairs <65492573+Sycamost@users.noreply.github.com> Date: Sun, 13 Aug 2023 20:41:29 +0100 Subject: Determines current locale with lib function --- src/layouts/Layout.astro | 8 ++++---- src/layouts/Page.astro | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/layouts') diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 9bca7e1..54b8c25 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -3,14 +3,14 @@ import Footer from '$components/Footer.astro'; import Navbar from '$components/Navbar.astro'; import translate from '$i18n/translate'; import site from '$i18n/translations/site'; -import type Locale from '$types/Locale'; +import getLocaleFromPath from '$lib/getLocaleFromPath'; interface Props { - locale: Locale; title: string; } -const { locale, title } = Astro.props; +const { title } = Astro.props; +const locale = getLocaleFromPath(Astro.url.pathname); const t = translate(locale); --- @@ -27,7 +27,7 @@ const t = translate(locale); {title} | {t(site, { key: 'title' })} - +