feat(SW-2333): I18n for multiple apps and packages * Set upp i18n in partner-sas * Adapt lokalise workflow to monorepo * Fix layout props Approved-by: Linus Flood
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import "@scandic-hotels/design-system/style.css"
|
|
import "@scandic-hotels/design-system/fonts.css"
|
|
import "@/public/_static/css/design-system-new-deprecated.css"
|
|
import "./globals.css"
|
|
|
|
import { Lang } from "@scandic-hotels/common/constants/language"
|
|
import { TrpcProvider } from "@scandic-hotels/trpc/Provider"
|
|
|
|
import { getMessages } from "../i18n"
|
|
import ClientIntlProvider from "../i18n/Provider"
|
|
import { setLang } from "../i18n/serverContext"
|
|
|
|
import type { Metadata } from "next"
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Create Next App",
|
|
description: "Generated by create next app",
|
|
}
|
|
|
|
type LangParams = {
|
|
lang: Lang
|
|
}
|
|
|
|
type RootLayoutProps = {
|
|
children: React.ReactNode
|
|
params: Promise<LangParams>
|
|
}
|
|
|
|
export default async function RootLayout(props: RootLayoutProps) {
|
|
// const params = await props.params
|
|
const params = { lang: Lang.sv }
|
|
|
|
const { children } = props
|
|
|
|
setLang(params.lang)
|
|
const messages = await getMessages(params.lang)
|
|
|
|
return (
|
|
<html lang="en">
|
|
<head>
|
|
{/* eslint-disable-next-line @next/next/no-css-tags */}
|
|
<link rel="stylesheet" href="/_static/css/core.css" />
|
|
{/* eslint-disable-next-line @next/next/no-css-tags */}
|
|
<link rel="stylesheet" href="/_static/css/scandic.css" />
|
|
</head>
|
|
<body className="scandic">
|
|
<ClientIntlProvider
|
|
defaultLocale={Lang.en}
|
|
locale={params.lang}
|
|
messages={messages}
|
|
>
|
|
{/* TODO handle onError */}
|
|
<TrpcProvider>{children}</TrpcProvider>
|
|
</ClientIntlProvider>
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|