Skip to content

Commit 608a68e

Browse files
committed
feat: Add setup file
1 parent 958e20b commit 608a68e

File tree

5 files changed

+154
-11
lines changed

5 files changed

+154
-11
lines changed

next.config.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import createNextIntlPlugin from "next-intl/plugin";
12
/** @type {import('next').NextConfig} */
23
const nextConfig = {};
34

4-
export default nextConfig;
5+
const withNextIntl = createNextIntlPlugin();
6+
export default withNextIntl(nextConfig);

package-lock.json

Lines changed: 122 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12+
"next": "15.2.2",
13+
"next-intl": "^3.26.3",
1214
"react": "^19.0.0",
13-
"react-dom": "^19.0.0",
14-
"next": "15.2.2"
15+
"react-dom": "^19.0.0"
1516
},
1617
"devDependencies": {
1718
"@tailwindcss/postcss": "^4",

src/app/layout.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { NextIntlClientProvider } from "next-intl";
2+
import { getMessages } from "next-intl/server";
13
import { Geist, Geist_Mono } from "next/font/google";
24
import "./globals.css";
35

@@ -16,14 +18,18 @@ export const metadata = {
1618
description: "Generated by create next app",
1719
};
1820

19-
export default function RootLayout({ children }) {
21+
export default async function RootLayout({ children }) {
22+
const messages = await getMessages();
23+
2024
return (
21-
<html lang="en">
22-
<body
23-
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
24-
>
25-
{children}
26-
</body>
27-
</html>
25+
<NextIntlClientProvider messages={messages}>
26+
<html lang="en">
27+
<body
28+
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
29+
>
30+
{children}
31+
</body>
32+
</html>
33+
</NextIntlClientProvider>
2834
);
2935
}

src/i18n/request.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { getRequestConfig } from "next-intl/server";
2+
3+
export default getRequestConfig(async () => {
4+
// Provide a static locale, fetch a user setting,
5+
// read from `cookies()`, `headers()`, etc.
6+
const locale = "en";
7+
8+
return {
9+
locale,
10+
messages: (await import(`../messages/${locale}.json`)).default,
11+
};
12+
});

0 commit comments

Comments
 (0)