feat: improve instantiation of intl
This commit is contained in:
@@ -14,8 +14,6 @@ import { getIntl } from "@/i18n"
|
||||
|
||||
import { SASModal } from "../components/SASModal"
|
||||
|
||||
import type { FormatXMLElementFn } from "intl-messageformat"
|
||||
|
||||
import type { LangParams, PageArgs, SearchParams } from "@/types/params"
|
||||
import type { State } from "../sasUtils"
|
||||
|
||||
@@ -82,10 +80,7 @@ export default async function SASxScandicLoginPage({
|
||||
</p>
|
||||
</Typography>
|
||||
<Footnote textAlign="center">
|
||||
{intl.formatMessage<
|
||||
React.ReactNode,
|
||||
FormatXMLElementFn<React.ReactNode>
|
||||
>(
|
||||
{intl.formatMessage(
|
||||
{
|
||||
id: "If you are not redirected automatically, please <loginLink>click here</loginLink>.",
|
||||
},
|
||||
|
||||
@@ -6,6 +6,7 @@ import "@scandic-hotels/design-system/style.css"
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
||||
import Script from "next/script"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { env } from "@/env/server"
|
||||
import TrpcProvider from "@/lib/trpc/Provider"
|
||||
|
||||
@@ -16,8 +17,8 @@ import { ToastHandler } from "@/components/TempDesignSystem/Toasts"
|
||||
import AdobeSDKScript from "@/components/TrackingSDK/AdobeSDKScript"
|
||||
import GTMScript from "@/components/TrackingSDK/GTMScript"
|
||||
import RouterTracking from "@/components/TrackingSDK/RouterTracking"
|
||||
import { getIntl } from "@/i18n"
|
||||
import ServerIntlProvider from "@/i18n/Provider"
|
||||
import { getMessages } from "@/i18n"
|
||||
import ClientIntlProvider from "@/i18n/Provider"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
|
||||
import type { LangParams, LayoutArgs } from "@/types/params"
|
||||
@@ -31,7 +32,7 @@ export default async function RootLayout({
|
||||
}
|
||||
setLang(params.lang)
|
||||
|
||||
const { defaultLocale, locale, messages } = await getIntl()
|
||||
const messages = await getMessages(params.lang)
|
||||
|
||||
return (
|
||||
<html lang={params.lang}>
|
||||
@@ -51,7 +52,11 @@ export default async function RootLayout({
|
||||
`}</Script>
|
||||
</head>
|
||||
<body className="scandic">
|
||||
<ServerIntlProvider intl={{ defaultLocale, locale, messages }}>
|
||||
<ClientIntlProvider
|
||||
defaultLocale={Lang.en}
|
||||
locale={params.lang}
|
||||
messages={messages}
|
||||
>
|
||||
<TrpcProvider>
|
||||
<RouterTracking />
|
||||
{children}
|
||||
@@ -61,7 +66,7 @@ export default async function RootLayout({
|
||||
<CookieBotConsent />
|
||||
<ReactQueryDevtools initialIsOpen={false} />
|
||||
</TrpcProvider>
|
||||
</ServerIntlProvider>
|
||||
</ClientIntlProvider>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user