diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx
index a6840dc..c341b9c 100644
--- a/app/[locale]/layout.tsx
+++ b/app/[locale]/layout.tsx
@@ -1,5 +1,7 @@
import type { Metadata } from "next";
import { Playfair_Display, Inter } from "next/font/google";
+import { NextIntlClientProvider } from "next-intl";
+import { getMessages } from 'next-intl/server';
import "./globals.css";
@@ -22,28 +24,35 @@ export const metadata: Metadata = {
description: "Portfolio de Mathéo Guilbert, développeur web freelance.",
};
-export default function RootLayout({
- children,
-}: Readonly<{
- children: React.ReactNode;
-}>) {
+export default async function RootLayout({
+ children,
+ params,
+}: {
+ children: React.ReactNode;
+ params: Promise<{ locale: string }>;
+}) {
+ const { locale } = await params;
+ const messages = await getMessages();
+
return (
-
+
-
-
-
-
- {/* Scrolling bloc */}
-
-
- {children}
-
+
+
+
+
-
-
+ {/* Scrolling bloc */}
+
+
+ {children}
+
+
+
+
+
);
-}
\ No newline at end of file
+}
diff --git a/i18n.ts b/i18n.ts
new file mode 100644
index 0000000..74b6c73
--- /dev/null
+++ b/i18n.ts
@@ -0,0 +1,15 @@
+import { getRequestConfig } from 'next-intl/server';
+import { notFound } from 'next/navigation';
+
+const locales = ['fr', 'en'];
+
+export default getRequestConfig(async ({ requestLocale }) => {
+ const locale = await requestLocale;
+
+ if (!locale || !locales.includes(locale)) notFound();
+
+ return {
+ locale,
+ messages: (await import(`./messages/${locale}.json`)).default
+ };
+});
\ No newline at end of file
diff --git a/next.config.ts b/next.config.ts
index e9ffa30..5183380 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -1,7 +1,10 @@
import type { NextConfig } from "next";
+import createNextIntlPlugin from 'next-intl/plugin';
const nextConfig: NextConfig = {
/* config options here */
};
-export default nextConfig;
+const withNextIntl = createNextIntlPlugin('./i18n.ts');
+
+export default withNextIntl(nextConfig);