* move setLang() to a root layout
* fix: findLang only returns acceptable languages * fix: fallback to use header x-lang if we haven't setLang yet * fix: languageSchema, allow uppercase Approved-by: Linus Flood
This commit is contained in:
16
app/[lang]/layout.tsx
Normal file
16
app/[lang]/layout.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { getLang, setLang } from "@/i18n/serverContext"
|
||||
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export default function Layout({
|
||||
children,
|
||||
params,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
params: { lang: Lang }
|
||||
}) {
|
||||
setLang(params.lang)
|
||||
const lang = getLang()
|
||||
|
||||
return <html lang={lang}>{children}</html>
|
||||
}
|
||||
Reference in New Issue
Block a user