hozana/next-translate-routes

Dynamic pages without index.js not translating trough translatePath

draxx318 opened this issue · 1 comments

Example folder structure:

pages(folder)
       destinations(folder)
              [id].js

_routes.json looks like this:

{
    "/": {
        "en": "destinations",
        "hr": "destinationsHr",
        "de": "destinationsDe"
    }
}

translatePath usage:
translatepath('/destinations', 'de')

In this case, translatePath returns the original page name instead of the translation. This only happens to dynamic routes without an index.js page.

Edit:
On folder structure with catch all routes works flawlessly.

pages(folder)
       destinations(folder)
              [[...id]].js

Yes, in the first config, there is not any page file matching the /destinations path. You could also add an pages/destinations/index. js file.