Problem with Router

translation

#1

Hello !
I ask you for help here cause I am unable to prefix my routes by the lang type.
I’ll try to explain more,
I have this code in /config/routes.php

Router::prefix('/', function (RouteBuilder $routes) {
    Router::connect('/', array(
        'controller' => 'home',
        'action' => 'index'
    ));
    // ..
});

How can I config the Router to connect all routes to a lang prefix ?
This would match with URLs like http://mydomain.com/en_US/signup
With the lang prefix to a parameter, so this url could be changed in /fr_FR/signup,
or /es_ES/signup,
Be lang should be a parameter to my controllers, to change the language dynamically.

I really dont know how to realize that, i searched in google, stackoverflow, and cake documentation and i didnt find nothing.
Can you help me ?

P.S.: I’m sorry for my eventually bad english, it’s not my main language…
(I cannot write more tags for this thread, i dont know how to.)

Thanks for reading !


#2

Try https://github.com/ADmad/cakephp-i18n