ZF-3097: Create new route for multilanguage sites
Description
An oft-used URL pattern for multi-lingual sites is to use the form '/:lang/...'. Currently, however, this is a difficult routing schema to achieve if you want to leave the flexibility to create a conventional modular site.
The suggestion is to create a route that extends the current Module route, and which takes an argument of a default language to use:
$router->addRoute('default', new Zend_Controller_Router_Route_Multilingual('de')); // default language is German
This would give such routes first-class support in the ZF MVC.
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2008-08-04T10:24:55.000+0000
Postponing to 1.7.0; Martel and DASPRiD are working on a solution, part of which is included in 1.6, but the rest of which will happen for 1.7.0. At that time, we can easily add language-based routes.
Posted by Ben Scholzen (dasprid) on 2008-10-18T17:44:36.000+0000
I'm only responsible for the config- and hostname-part. Martel is the maintainer of the actual partial path chaining. As he is currently quite busy, I don't think that partial path chaining will make it into 1.7. Even 1.8 isn't really clear.
Posted by Matthew Weier O'Phinney (matthew) on 2008-11-05T11:11:47.000+0000
Assigning to Ben; this is addressed with chained routes in 1.7.0, IIRC.
Posted by Ben Scholzen (dasprid) on 2009-04-18T13:50:07.000+0000
Partial path route implemented in 1.8.
Posted by Thorsten Ruf (saphir2k) on 2009-05-11T15:05:12.000+0000
Can anybody of the participants explain, how to solve the requirements of a default multilanguage route? I can't see an solution using chained routes.
Posted by Ben Scholzen (dasprid) on 2009-05-11T16:29:34.000+0000
You simply take a standard route ":language", and all your other routes. Then you say for example
For more examples, see documentation or ask in #zftalk on chat.freenode.org.