hozana / next-translate-routes

Flexible and translated routes for Next.js without custom server
MIT License
116 stars 30 forks source link

TranslatePath does not respect ignored segment #34

Closed netdown closed 2 years ago

netdown commented 2 years ago

Hi,

I have the following route configuration in pages/landing/_routes.json: { "/": { "default": "." }, "print": { "hu": "foto", "en": "prints" } }

I call translatePath like this: translatePath('landing/print')

I would expect the function to return /foto (or /prints). However, it does return landing/foto. Note that the page urls are working fine, so my page loades at /foto and not at /landing/foto, the issue is only with the links.

cvolant commented 2 years ago

Thanks for the report. It is a bug, but waiting for it to be solved, you can try with "/": "." instead of "/": { "default": "." }.

cvolant commented 2 years ago

Ok, I tried to solve this bug, and did not reproduce it until I saw that you forgot translatePath second argument: the locale. You don't told it in what language you want to translate the path...