feat: install next-intl and set up i18n routing config

This commit is contained in:
2026-08-10 15:32:11 +02:00
parent cad0584af3
commit 0a75aba78b
6 changed files with 464 additions and 18 deletions
+13
View File
@@ -0,0 +1,13 @@
import { getRequestConfig } from 'next-intl/server'
import { routing } from './routing'
export default getRequestConfig(async ({ requestLocale }) => {
let locale = await requestLocale
if (!locale || !(routing.locales as readonly string[]).includes(locale)) {
locale = routing.defaultLocale
}
return {
locale,
messages: (await import(`../../messages/${locale}.json`)).default,
}
})
+6
View File
@@ -0,0 +1,6 @@
import { defineRouting } from 'next-intl/routing'
export const routing = defineRouting({
locales: ['en', 'fr', 'es', 'it'],
defaultLocale: 'en',
})
+4
View File
@@ -0,0 +1,4 @@
import { createNavigation } from 'next-intl/navigation'
import { routing } from './i18n/routing'
export const { Link, redirect, usePathname, useRouter } = createNavigation(routing)