Hi,
I'm trying to do something similar to this as well, but have a problem. I
have this code:
if (preg_match('/^\/(en|de)(.*?)$/', $uri, $matches)) {
$request->setRequestUri($matches[2]);
}
Which works. /about, /en/about and /de/about all go to the right place. But
the URLs created with the view URL helper don't contain the language code
that was stripped from the request URL. How can I get it to leave this on if
it exists?
I tried playing with the setBaseUrl method, but whatever I set it to seemed
to break it.
Thanks.
Matthew Weier O'Phinney-3 wrote:
>
>
> You have two options. One is to create your own default route by
> extending Zend_Controller_Router_Route_Module and modifying it to check
> for a language segment in the first path position. The second is to
> strip it off the request URI and pass the modified request URI to
> the request object in your bootstrap:
>
> $uri = $_SERVER['REQUEST_URI'] ;
> if (preg_match('#^/([a-z]{2})/#', $uri, $matches)) {
> Zend_Registry::set('language', $matches[1]);
> $request = new Zend_Controller_Request_Http();
> $uri = substr($uri, 4);
> $request->setRequestUri($uri);
> $front->setRequest($request);
> }
>
>
--
View this message in context:
http://www.nabble.com/Zend-Frmework-Language-ID-Prefixing-tf4686873s16154.html#a13529393
Sent from the Zend Framework mailing list archive at Nabble.com.