-
Notifications
You must be signed in to change notification settings - Fork 26
Adding custom routes for each language #18
Comments
Nobody knows how to get this? :-( |
What exactly is not working? What is expected? Can you provide a unit test? |
I'll give a clearer example: I want http://www.example.com/posts to be parsed as array('lang'=>'eng', 'controller' => 'posts', 'action' => 'index') I have the following code but it doesn't work: App::uses('I18nRoute', 'Lang.Routing/Route'); Router::connect('/posts', array('lang'=>'eng', 'controller' => 'posts', 'action' => 'index')); Any idea? |
This App::uses('I18nRoute', 'Lang.Routing/Route'); should be App::uses('I18nRoute', 'I18n.Routing/Route'); |
Sorry, in my example I located the file in a different Plugin name, but the problem is the same. Actually the plugin work fine, if I have "Router::connect('/posts', array('controller' => 'posts', 'action' => 'index'));" and I load http://www.example.com/spa/posts in my browser it works fine. The only thing I'like to implement is instead of http://www.example.com/spa/posts to be able to convert it in http://www.example.com/noticias with routing rules: I want http://www.example.com/posts to be parsed as array('lang'=>'eng', 'controller' => 'posts', 'action' => 'index') Is this the correct way?? Thank you |
No, this plugin is for automatically setting the language for page contents, not for translating the url |
@burzum could you put an example? I tried also with the default route class with no success... |
… setting the language based on the url NOT for translating the url itself to something. This is related to CakeDC#18
I want to add some custom routes for each language. Example:
App::uses('I18nRoute', 'Lang.Routing/Route');
Router::defaultRouteClass('I18nRoute');
Router::connect('/english-page', array('lang'=>'eng', 'controller' => 'pages', 'action' => 'display', 'my_page'));
Router::connect('/spanish-page', array('lang'=>'spa', 'controller' => 'pages', 'action' => 'display', 'my_page'));
But it doesn't work. Is it a bug? Or how should I do to get this working?
The text was updated successfully, but these errors were encountered: