My solution is to rewrite the Router::base
in your app_controller.php beforeFilter()
-----------------------------------------
//INTERNAZIONALIZATION
if(Configure::Read('Multilingual.enable')){
//$this->base = $this->base.'/'.$this->params['language'].'/';
if(__RQL__ != '' && __RQL__ != 'it' && !isset($this->params
[Configure::read('Routing.admin')])){
$this->base = $this->base.'/'.__RQL__.'/';
$router =& Router::getInstance();
$router->__paths[0]["base"]=$router->__paths[0]
["base"].DS.__RQL__;
}
}
-----------------------------------------
in your config/bootstrap.php
-----------------------------------------
//INTERNAZIONALIZATION
Configure::write('Multilingual.enable', 1);
if(Configure::Read('Multilingual.enable')){
$config['websiteConfig']['languages'] = array('it'=>'ita',
'en'=>'eng');
$uriLang = 'it';
$languageKeys = array_keys($config['websiteConfig']
['languages']);
if (isset($_GET['url']) && in_array( substr( $_GET['url'], 0,
strpos( $_GET['url'], '/' ) ), $languageKeys)) {
//if(!defined('__RQL__'))
$uriLang = substr( $_GET['url'], 0, strpos( $_GET['url'],
'/' ) );
$_GET['url'] = substr( $_GET['url'], 3, 255 );
Configure::write('Config.language', $config
['websiteConfig']['languages'][$uriLang]);
}
define('__RQL__', $uriLang);
if(__RQL__ == ''){
define('DEFAULT_LANGUAGE', 'ita');
}
else{
define('DEFAULT_LANGUAGE', $config['websiteConfig']
['languages'][__RQL__]);
}
//echo strlen( substr( $_GET['url'], 0, strpos( $_GET['url'],
'/' ) ) ) == 3 ));
if(!defined('DEFAULT_LANGUAGE')){
define('DEFAULT_LANGUAGE', 'ita');
}
//debug(__RQL__);
//debug(DEFAULT_LANGUAGE);
}
in your config/routes.php
-----------------------------------------
Router::connect('/it', array('controller' => 'pages', 'action' =>
'display', 'home'));
Router::connect('/en', array('controller' => 'pages', 'action' =>
'display', 'home'));
-----------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---