Skip to content

Instantly share code, notes, and snippets.

Created May 5, 2015 11:22
Show Gist options
  • Save anonymous/5f9b2f12092359f2edbc to your computer and use it in GitHub Desktop.
Save anonymous/5f9b2f12092359f2edbc to your computer and use it in GitHub Desktop.
I'am trying to localize my website. majordog.fr/fr_FR/Users/login (majordog.fr/fr_FR/users/login not workin, this is my bug)
use Cake\Core\Plugin;
use Cake\Routing\Router;
Router::defaultRouteClass('Route');
Router::scope('/', function ($routes) {
$languageCodes = array('language' => 'fr_FR|pt_BR');
$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
$routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
$routes->connect('/:language', array('controller' => 'Pages', 'action' => 'display', 'home'), $languageCodes);
$routes->connect('/', array('controller' => 'Pages', 'action' => 'display', 'home'));
$routes->connect('/:language', array('controller' => 'Pages', 'action' => 'display', 'home'), $languageCodes);
$routes->connect('/:language/pages/*', array('controller' => 'Pages', 'action' => 'display'), $languageCodes);
$routes->connect('/:language/:controller/:action/*', array(), $languageCodes);
$routes->connect('/:language/:controller', array('action' => 'index'), $languageCodes);
$routes->fallbacks('InflectedRoute');
});
Plugin::routes();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment