diff --git a/src/app/[lang]/not-found.tsx b/src/app/[lang]/not-found.tsx index deffbb2..8021649 100644 --- a/src/app/[lang]/not-found.tsx +++ b/src/app/[lang]/not-found.tsx @@ -1,12 +1,20 @@ import Link from 'next/link'; +import { cookies } from 'next/headers'; import { Button } from '@/components/ui/button'; import { getDictionary } from '@/components/internationalization/dictionaries'; -import type { Locale } from '@/components/internationalization/config'; +import { i18n, type Locale } from '@/components/internationalization/config'; + +async function resolveLocale(): Promise { + const store = await cookies(); + const cookieLocale = store.get('NEXT_LOCALE')?.value; + return (i18n.locales as readonly string[]).includes(cookieLocale ?? '') + ? (cookieLocale as Locale) + : i18n.defaultLocale; +} export default async function NotFound() { - // For not-found pages, we can't reliably get locale from params - // so we'll default to English and handle this gracefully - const dict = await getDictionary('en'); + const locale = await resolveLocale(); + const dict = await getDictionary(locale); return (
@@ -16,11 +24,11 @@ export default async function NotFound() {

{dict.errors.notFound}

); -} \ No newline at end of file +}