Skip to content

Instantly share code, notes, and snippets.

@lorenzo
Forked from anonymous/gist:5f9b2f12092359f2edbc
Last active August 29, 2015 14:20
Show Gist options
  • Save lorenzo/ab1e1c9551c4d8fa42ef to your computer and use it in GitHub Desktop.
Save lorenzo/ab1e1c9551c4d8fa42ef to your computer and use it in GitHub Desktop.
<?php
use Cake\Core\Plugin;
use Cake\Routing\Router;
Router::defaultRouteClass('Route');
$languageCodes = array('fr_FR', 'pt_BR');
$builder = function ($routes) {
$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
$routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
$routes->fallbacks('InflectedRoute');
};
foreach ($languageCodes as $code) {
Router::scope("/$code", ['lang' => $code], $builder);
}
Plugin::routes();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment