Handle default locale on Next 13 App Router

143 views Asked by At

I have a project using Next 13 app router and pages router at same time, I'm using next-translate as my i18n package but I'm facing a problem with the pages generated by app router

I want my default locale to open without having a prefix Example: fr/blog > fr/blog en/blog > /blog

This works fine on my pages generated by page router, my homepage opens as localhost:3000 for the en version and localhost:3000/fr for the fr version, but when it comes to the app router pages, it just not work - my translations are being translated but I need to pass the prefix in every scenario

fr/blog works en/blog works /blog redirects me to a 404 (should open normally with EN as the locale)

How can I handle this on Next 13 using next-translate? I build a simple example on github so you're able to check: https://github.com/mbaldas/default-locale-issue

  1. Start the application - npm run dev
  2. Go to http://localhost:3000/en/test-router/slugish-url and verify that runs fine
  3. Go to http://localhost:3000/fr/test-router/slugish-url and verify that runs fine
  4. Go to http://localhost:3000/test-router/slugish-url and verify that it redirects to a 404
0

There are 0 answers