diff --git a/src/app/[locale]/not-found.tsx b/src/app/[locale]/not-found.tsx index 51b55f5..5616de8 100644 --- a/src/app/[locale]/not-found.tsx +++ b/src/app/[locale]/not-found.tsx @@ -16,13 +16,16 @@ export const metadata: Metadata = { description: "Discover our bestselling natural oils for hair and skin care.", }; -interface NotFoundPageProps { - params: Promise<{ locale: string }>; -} - -export default async function NotFoundPage({ params }: NotFoundPageProps) { - const { locale } = await params; - const validLocale = isValidLocale(locale) ? locale : DEFAULT_LOCALE; +export default async function NotFoundPage() { + // Get locale from URL path + const headersList = await headers(); + const pathname = headersList.get("x-invoke-path") || headersList.get("x-matched-path") || "/"; + + // Extract locale from path (e.g., /en/products → en, /sr/products → sr) + const pathSegments = pathname.split("/").filter(Boolean); + const potentialLocale = pathSegments[0]; + const validLocale = isValidLocale(potentialLocale) ? potentialLocale : DEFAULT_LOCALE; + const t = await getTranslations({ locale: validLocale, namespace: "NotFound" }); const productReviewT = await getTranslations({ locale: validLocale, namespace: "ProductReviews" }); @@ -49,7 +52,6 @@ export default async function NotFoundPage({ params }: NotFoundPageProps) { }>; // Track 404 page view via OpenPanel (client-side will handle this) - const headersList = await headers(); const referer = headersList.get("referer") || ""; return ( @@ -189,7 +191,7 @@ export default async function NotFoundPage({ params }: NotFoundPageProps) {
+ {t("subtitle")} +
+ + + {t("shopBestsellers")} ++ {price || "Contact for price"} +
+No products available at the moment.
++ “{review.text}” +
+{review.name}
+{review.location}
++ {t("finalCTASubtitle")} +
+ + + {t("viewAllProducts")} +