fix: localize 404 and ensure header when no lang

This commit is contained in:
Christel Westerberg
2024-06-04 13:35:45 +02:00
parent 74b05ed6a0
commit d5b08e3a36
8 changed files with 282 additions and 12 deletions

View File

@@ -0,0 +1,11 @@
import { Lang } from "@/constants/languages"
import NotFound from "@/components/Current/NotFound"
import { LangParams, PageArgs } from "@/types/params"
export default function NotFoundPage({ params }: PageArgs<LangParams>) {
const lang = params.lang || Lang.en
return <NotFound lang={lang} />
}

View File

@@ -1,11 +1,12 @@
import { getIntl } from "@/i18n"
import { headers } from "next/headers"
export default async function NotFound() {
const { formatMessage } = await getIntl()
return (
<main>
<h1>{formatMessage({ id: "Not found" })}</h1>
<p>{formatMessage({ id: "Could not find requested resource" })}</p>
</main>
)
import { Lang } from "@/constants/languages"
import NotFound from "@/components/Current/NotFound"
export default function NotFoundPage() {
const headersList = headers()
const lang = headersList.get("x-sh-language") as Lang
return <NotFound lang={lang} />
}