Pages router - Localized pathnames #1004
-
Hello! 👋 I'm working on a Next.js project using Pages router, and I'm trying to create localized pathnames for static subpages based on locales. Currently, I have a very simple setup where I want to handle just the about page. I've tried to follow the documentation for both next-intl and Next.js. Accordingly, I added an i18n object in the next.config.js file:
Then, in the
Here's my question: could I ask for your advice on what I might be doing wrong? I'm currently trying to access the local subpage at http://localhost:3000/pl/o-nas, but I'm getting a 404 error. I still have to go to http://localhost:3000/pl/about. Thank you in advance for any tips! 🙌 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Thanks for the question! The localized pathnames are in fact a newer feature that has been added as part of the App Router support. To be honest, I never experimented with how it works with the Pages Router. There is, however, an example that illustrates how the Pages Router and App Router can be used side-by-side: App Router Migration. In that example, the Maybe that puts you in a better position where localized pathnames could work in the Pages Router? |
Beta Was this translation helpful? Give feedback.
-
@amannn, sure thing, I'll try to resolve it in a different way. Thanks for the clarification! :) |
Beta Was this translation helpful? Give feedback.
Thanks for the question! The localized pathnames are in fact a newer feature that has been added as part of the App Router support. To be honest, I never experimented with how it works with the Pages Router.
There is, however, an example that illustrates how the Pages Router and App Router can be used side-by-side: App Router Migration. In that example, the
i18n
feature from the Pages Router is not used and routing is being handled by the middleware.Maybe that puts you in a better position where localized pathnames could work in the Pages Router?