next-routes icon indicating copy to clipboard operation
next-routes copied to clipboard

add locale to url

Open apapacy opened this issue 6 years ago • 4 comments

Now I can write

routes
.add('index', '/:lang(ru|en)?', 'index')
.add('about', '/:lang(ru|en)?/about', 'about')
...

It is possible to release?

routes
.add('i18n', '/:lang(ru|en)?/:path?', ':path');

Im try to add custom handler but it work only on server

function customHandler(args) {
  const {req, res, route, query} = args;
  const path = query.path ? query.path : '';
  app.render(req, res, `/${path}`, query);
}

Is the way to customize on client?

apapacy avatar Oct 22 '17 14:10 apapacy

Not yet, but it’s a good idea! We could make the page parameter optionally accept a function, that receives the params and returns the page

fridays avatar Nov 01 '17 05:11 fridays

If anyone wants to look into this right away, changes need to be done here and here

fridays avatar Nov 01 '17 05:11 fridays

I would love this funcitonality it looks exactly what I need

sammdec avatar Apr 16 '18 10:04 sammdec

Any update on this?

petertulala avatar Jan 19 '19 19:01 petertulala