Wednesday, May 29, 2013

Routes and multilanguage site

Hi,

We have a problem with routes and our multilanguage site. We tried different salutions, but we can't get it to work.

We have set it up like this:
  Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
Router::connect('/:language', array('controller' => 'pages', 'action' => 'display', 'home'), array('language' => 'eng|ned|deu'));
Router::connect('/:language/:controller/:action/*', array(), array('language' => '[a-z]{3}'));

But we can't get the other urls to change, for example:
Router::connect('/:language/portfolio', array('controller' => 'portfolioitems', 'action' => 'index'), array('language' => 'eng|ned|deu'));
This doesn't work.

What are we doing wrong? Or how do we need to set things up?

-----------

A more complicated question, is it possible to get 3 different urls from the same controller for the 3 different languages? For example (newsitems controller):
websitename.com/eng/news
websitename.com/ned/nieuws
websitename.com/deu/nachrichten
If someone knows this, please share! But it is more important for us to get the first part of my question working.

------------

If you have any question to make it more clear, please ask! I will try to answer as best as I can.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: