Unable to find solution to moving app/[[...slug]] to app/[locale]/[[...slug]] #1555
-
Hi all, My project is running with NextJS 14 using app router, and it has structure as below: app and it working fine with single language, allow user define the pathname(slug) for the page they create in CMS. However, when switching to multi language, following the example at https://github.com/amannn/next-intl/tree/main/examples/example-app-router, I update my project structure as below and it is not working, the request not come to page.tsx, it just runs at layout.tsx. app I think the problem in i18n/routing.ts but I'm not so sure how to update pathnames as I don't have folder pathnames. 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: ['vi-VN', 'en-US'],
localeDetection: false,
// Used when no locale matches
defaultLocale: 'vi-VN',
localePrefix: {
mode: 'always',
prefixes: {
'en-US': '/en',
'vi-VN': '/vi'
}
},
});
// Lightweight wrappers around Next.js' navigation APIs
// that will consider the routing configuration
export const {Link, redirect, usePathname, useRouter} = createNavigation(routing); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hmm, haven't encountered this so far. Can you by chance share a reproduction based on next-intl-bug-repro-app-router if your project is closed source? Would be curious to have a look … |
Beta Was this translation helpful? Give feedback.
-
Hi @amannn Thank you for this awesome project. Just ignore my stupid question, the root cause came from my data as the code should return custom 404 page with not-found.tsx in the same folder but I forgot to setup 404 content in the CMS so 404 page can not found 404 custom content !!! The structure above working normally, no need to setup 'pathnames'. |
Beta Was this translation helpful? Give feedback.
Hi @amannn
Thank you for this awesome project. Just ignore my stupid question, the root cause came from my data as the code should return custom 404 page with not-found.tsx in the same folder but I forgot to setup 404 content in the CMS so 404 page can not found 404 custom content !!!
The structure above working normally, no need to setup 'pathnames'.