Created src/lib/i18n/locales.ts as single source of truth for: - SUPPORTED_LOCALES array - LOCALE_COOKIE name - DEFAULT_LOCALE - LOCALE_CONFIG (labels, flags, Saleor locale mapping) - Helper functions (isValidLocale, getSaleorLocale, getLocaleFromPath) Updated all files to use centralized constants: - middleware.ts - Header.tsx - ProductCard.tsx - sitemap.ts - root layout and locale layout - routing.ts Benefits: - Adding new locale only requires updating ONE file (locales.ts) - No more hardcoded locale lists scattered across codebase - Cookie name defined in one place - Type-safe locale validation
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import "./globals.css";
|
|
import type { Metadata, Viewport } from "next";
|
|
import ErrorBoundary from "@/components/providers/ErrorBoundary";
|
|
import { SUPPORTED_LOCALES } from "@/lib/i18n/locales";
|
|
|
|
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || "https://dev.manoonoils.com";
|
|
|
|
export const metadata: Metadata = {
|
|
title: {
|
|
default: "ManoonOils - Premium Natural Oils for Hair & Skin",
|
|
template: "%s | ManoonOils",
|
|
},
|
|
description: "Discover our premium collection of natural oils for hair and skin care.",
|
|
robots: "index, follow",
|
|
alternates: {
|
|
canonical: baseUrl,
|
|
languages: Object.fromEntries(
|
|
SUPPORTED_LOCALES.map((locale) => [locale, locale === "sr" ? baseUrl : `${baseUrl}/${locale}`])
|
|
),
|
|
},
|
|
openGraph: {
|
|
title: "ManoonOils - Premium Natural Oils for Hair & Skin",
|
|
description: "Discover our premium collection of natural oils for hair and skin care.",
|
|
type: "website",
|
|
locale: "en_US",
|
|
},
|
|
};
|
|
|
|
export const viewport: Viewport = {
|
|
width: "device-width",
|
|
initialScale: 1,
|
|
maximumScale: 5,
|
|
};
|
|
|
|
export default async function RootLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
return (
|
|
<html suppressHydrationWarning>
|
|
<body className="antialiased" suppressHydrationWarning>
|
|
<ErrorBoundary>
|
|
{children}
|
|
</ErrorBoundary>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|