Opting out of pages router locale to prepare migration to app router
Unanswered
Mrigal carp posted this in #help-forum
Mrigal carpOP
Hi,
I am trying to migrate to the app router.
The app router does not handle locale natively, we have to use a dynamic route.
I am trying to get there using incremental migration, so the first step consists in removing the locale handling of the page router and handle it "manually".
So far so good, I removed the locales configuration in next.config.js and moved every pages inside a new [locale] folder.
Now, I need to replace every navigation I had in the project:
becomes
(with
Is there any lighter approach in the code? For example, a way to keep some current query parameters when using Link or router?
Also, is there any resource to handle incremental pages to app migration that includes locale handling?
I am trying to migrate to the app router.
The app router does not handle locale natively, we have to use a dynamic route.
I am trying to get there using incremental migration, so the first step consists in removing the locale handling of the page router and handle it "manually".
So far so good, I removed the locales configuration in next.config.js and moved every pages inside a new [locale] folder.
Now, I need to replace every navigation I had in the project:
router.push(/board-games/${boardGameId}/${tab})becomes
router.push(/${locale}/board-games/${boardGameId}/${tab})(with
locale = router.query.locale as string for now.Is there any lighter approach in the code? For example, a way to keep some current query parameters when using Link or router?
Also, is there any resource to handle incremental pages to app migration that includes locale handling?