How to keep language in URL?


Hi all,

I want to keep language in URL as:

How can I do that with Route group & prefix? (or any solution)

Language code should be passed dynamically as route param

Thank you so much!

p/s: I only want to get language code via route param, not session or cookie :slight_smile:


Hey @donamkhanh! :wave:

What have you tried so far?


Hi @romain.lanz!

I tried: => {
  Route.resource('users', 'UserController');
}).prefix('en'); => {
  Route.resource('users', 'UserController');

and use middleware to handler the language code (as the first parameter)

What should we do if we have lot of locales? Must put the into a loop in available locales, right?