Merged in feature/refactor-lang (pull request #387)

feat: SW-238 Avoid prop drilling of lang

Approved-by: Michael Zetterberg
This commit is contained in:
Niclas Edenvin
2024-08-14 11:00:20 +00:00
parent 35128dbf44
commit e67212bd94
94 changed files with 378 additions and 322 deletions

View File

@@ -11,6 +11,7 @@ import VwoScript from "@/components/Current/VwoScript"
import { preloadUserTracking } from "@/components/TrackingSDK"
import { getIntl } from "@/i18n"
import ServerIntlProvider from "@/i18n/Provider"
import { getLang, setLang } from "@/i18n/serverContext"
import type { Metadata } from "next"
@@ -30,11 +31,12 @@ export default async function RootLayout({
header: React.ReactNode
}
>) {
setLang(params.lang)
preloadUserTracking()
const { defaultLocale, locale, messages } = await getIntl()
return (
<html lang={params.lang}>
<html lang={getLang()}>
<head>
<AdobeSDKScript />
<Script data-cookieconsent="ignore" src="/_static/js/cookie-bot.js" />
@@ -53,10 +55,10 @@ export default async function RootLayout({
</head>
<body>
<ServerIntlProvider intl={{ defaultLocale, locale, messages }}>
<TrpcProvider lang={params.lang}>
<TrpcProvider>
{header}
{children}
<Footer lang={params.lang} />
<Footer />
</TrpcProvider>
</ServerIntlProvider>
</body>