Quantcast

ZF2 - Zend\Mvc\Router\Http\Part - ServiceManager / ModuleManager Configuration

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

ZF2 - Zend\Mvc\Router\Http\Part - ServiceManager / ModuleManager Configuration

chameleon95
I am creating a multi lingual application using ZF2.. and cannot determine how to add a part URL which will form the base of each URL regardless of modules.

http://localhost/en/us/application/index/index/
I totally understand how to configure /[:namespace[/:controller[/:action]]] using DI

http://localhost/application/index/index/
http://localhost/guestbook/index/index/
http://localhost/forum/index/index/
What I do not understand is how to configure a Part route which will be the base for all routes.. In ZF1 I used Route Chaining to achieve this..

So I need to configure a Part route of /[:lang[/:locale]] which applies site wide and then let the module configure /[:namespace[/:controller[/:action]]] or any other route necessary..

The final route required is /[:lang[/:locale/[:namespace[/:controller[/:action]]]]]

http://localhost/en/us/application/index/index/
http://localhost/zh/cn/application/index/index/
http://localhost/en/uk/forum/index/index/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF2 - Zend\Mvc\Router\Http\Part - ServiceManager / ModuleManager Configuration

dmitrybelyakov
This post was updated on .
You can use TreeRouteStack with child_routes to nest your routing rules.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF2 - Zend\Mvc\Router\Http\Part - ServiceManager / ModuleManager Configuration

nakupanda
In reply to this post by chameleon95
Hi,

Could you please share your way implementing multilanguage using zf2 ?

I didn't get any official practice about this,

Thanks
Loading...