-
Notifications
You must be signed in to change notification settings - Fork 2
/
navigation.ts
37 lines (33 loc) · 991 Bytes
/
navigation.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import {
createLocalizedPathnamesNavigation,
Pathnames,
} from "next-intl/navigation";
export const locales = ["en", "tr"] as const;
// The `pathnames` object holds pairs of internal
// and external paths, separated by locale.
export const pathnames = {
// If all locales use the same pathname, a
// single external path can be provided.
"/": "/",
// If locales use different paths, you can
// specify each external path per locale.
"/about": {
en: "/about",
tr: "/hakkimda",
},
"/about#guestbook": {
en: "/about#guestbook",
tr: "/hakkimda#ziyaretcidefteri",
},
"/projects": {
en: "/projects",
tr: "/projeler",
},
// Dynamic params are supported via square brackets
"/projects/[endpoint]": {
en: "/projects/[endpoint]",
tr: "/projeler/[endpoint]",
},
} satisfies Pathnames<typeof locales>;
export const { Link, redirect, usePathname, useRouter, getPathname } =
createLocalizedPathnamesNavigation({ locales, pathnames });