ZF-3097: Create new route for multilanguage sites

Issue Type: New Feature Created: 2008-04-11T07:39:06.000+0000 Last Updated: 2009-05-11T16:29:46.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Matthew Weier O'Phinney (matthew) Assignee: Ben Scholzen (dasprid) Tags: - Zend_Controller

Related issues: - ZF-3223



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:

<pre class="highlight">
$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.


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

<pre class="highlight">
$languageRoute = new Zend_Controller_Router_Route(':language', array('language' => 'de');
$blogRoute = new Zend_Controller_Router_Route_Static('blog');
$blogRoute = $languageRoute->chain($blogRoute);

For more examples, see documentation or ask in #zftalk on

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.