hozana / next-translate-routes

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

Add the ability to export the translations directly from the pages #69

Closed Designer023 closed 8 months ago

Designer023 commented 1 year ago

It would be really nice if instead of using _routes.json or _routes.yaml if we could export the translates routes directly from the page itself eg.

// about page

export const i18n = {
   routes: {
     fr: "à-propos",
     es: "acerca-de
    }
}

This would result in 2 pages for the /fr/à-propos and /es/acerca-de along side the original /about page.

P.S. Great work on this project 👍

cvolant commented 12 months ago

Yes, it could be handy... but, how would you translate a directory segment? I mean, consider the following pages directory:

/pages/
 └ section/
     └ page.tsx

How would you translate the "section" segment in the url /section/page?