Skip to content

Commit ad85f0c

Browse files
Merge pull request #722 from franz-bendezu/dependabot/npm_and_yarn/next-intl-4.0.1
fix(deps): bump next-intl from 3.26.5 to 4.0.1
2 parents 133e80e + fcd26a6 commit ad85f0c

32 files changed

+161
-114
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"extensions": [
1010
"bradlc.vscode-tailwindcss",
1111
"esbenp.prettier-vscode",
12-
"dbaeumer.vscode-eslint"
12+
"dbaeumer.vscode-eslint",
13+
"vitest.explorer"
1314
]
1415
}
1516
}

global.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// global.d.ts
2+
import type { routing } from "./i18n/routing";
3+
import type messagesEn from "@/messages/en.json";
4+
import type messagesEs from "@/messages/es.json";
5+
6+
declare module "next-intl" {
7+
interface AppConfig {
8+
Locale: (typeof routing.locales)[number];
9+
Messages: typeof messagesEn | typeof messagesEs;
10+
}
11+
}

i18n.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

i18n/navigation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createNavigation } from "next-intl/navigation";
2+
import { routing } from "./routing";
3+
4+
export const { Link, redirect, usePathname, useRouter } =
5+
createNavigation(routing);

i18n/request.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { getRequestConfig } from "next-intl/server";
2+
import { hasLocale } from "next-intl";
3+
import { routing } from "./routing";
4+
5+
export default getRequestConfig(async ({ requestLocale }) => {
6+
// Typically corresponds to the `[locale]` segment
7+
const requested = await requestLocale;
8+
const locale = hasLocale(routing.locales, requested)
9+
? requested
10+
: routing.defaultLocale;
11+
return {
12+
locale,
13+
messages: (await import(`@/messages/${locale}.json`)).default,
14+
};
15+
});

i18n/routing.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { DEFAULT_LOCALE, LOCALES } from '@/constants/locales';
2+
import {defineRouting} from 'next-intl/routing';
3+
4+
export const routing = defineRouting({
5+
locales: LOCALES.map((l) => l.locale),
6+
defaultLocale: DEFAULT_LOCALE,
7+
});

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@tailwindcss/postcss": "^4.0.13",
1616
"next": "^15.2.2",
1717
"next-image-export-optimizer": "^1.18.0",
18-
"next-intl": "^3.26.5",
18+
"next-intl": "^4.0.1",
1919
"next-themes": "^0.4.6",
2020
"prettier": "^3.5.3",
2121
"react": "^19.0.0",

src/__tests__/about.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { NextIntlClientProvider } from "next-intl";
55
import { act } from "react";
66

77
vi.mock("next-intl/server", () => ({
8-
unstable_setRequestLocale: vi.fn(),
8+
setRequestLocale: vi.fn(),
99
}));
1010

1111
test("Page", async () => {

src/__tests__/contact.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ vi.mock("@formspree/react", () => ({
1010
}));
1111

1212
vi.mock("next-intl/server", () => ({
13-
unstable_setRequestLocale: vi.fn(),
13+
setRequestLocale: vi.fn(),
1414
}));
1515

1616
test("Page", async () => {

0 commit comments

Comments
 (0)