diff --git a/src/i18n/routing.ts b/src/i18n/routing.ts new file mode 100644 index 0000000..5985c3b --- /dev/null +++ b/src/i18n/routing.ts @@ -0,0 +1,19 @@ +import {defineRouting} from 'next-intl/routing'; +import {createNavigation} from 'next-intl/navigation'; + +export const routing = defineRouting({ + // A list of all locales that are supported + locales: ['en', 'fa'], + + // Used when no locale matches + defaultLocale: 'en', + + // Custom prefix mode so that default locale doesn't get prefix + localePrefix: 'as-needed' +}); + +// Lightweight wrappers around Next.js' navigation APIs +// that will automatically consider the routing configuration +export const {Link, redirect, usePathname, useRouter, getPathname} = + createNavigation(routing); +