News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Robert Basic's Blog:
A hack for Zend Framework's translated route segments
April 15, 2011 @ 09:17:40

Robert Basic has put together a new post to his blog about a hack he's found for the Zend Framework translated route segments when a "gotcha" popped up when he was trying to use them in a multi-language website.

The web site's default locale, language, is English. If the user has no locale in the session/cookie, she, or he, will get the English version of the web site. [...] But! If the user's first visit is on the http://example.com/vesti URL ("vesti" is "news" in Serbian), the router can't route that because it depends on the locale and the default locale is English and not Serbian, thus directing the user to the 404 page.

To get around this issue he created a front controller plugin that fires in the postDispatch hook to change the locale manually if the current request's isn't found to be English. It then redirects the user to the correct location for the new language and things proceed normally.

0 comments voice your opinion now!
zendframework hack multilanguage route segment issue


blog comments powered by Disqus

Similar Posts

Raphael Stolt's Blog: Scaffolding, implementing & using project specific Zend_Tool_Project_Provider

Greg Beaver's Blog: Statistics are back up for pear.php.net

Padraic Brady's Blog: Contributing To Zend Framework 2.0 Is Free! Hurry Before This Offer Ends!

Zend Developer Zone: A couple of good Zend Framework articles

Rob Allen's Blog: An introduction to Zend\EventManager


Community Events





Don't see your event here?
Let us know!


series threedevsandamaybe framework opinion code release laravel unittest symfony2 introduction language install developer list interview configure community testing refactor podcast

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework