debussy007 wrote:
>
> Hi,
>
> I am internationalizating my web app and I need to know for every request
> which language is chosen.
>
> So I want to add in the start of the url something like:
> http://example.com/fr/myController/myAction
> http://example.com/en/myController/myAction
>
> But this will make zend think "fr" and "en" is a module.
>
> How can I achieve this ?
>
> Thank you for any advice !!
>
i did something like following:
1) create and register a plugin
2) set a global or (Zend::Registry) variable which contains the list of
languages
3) in plugin
public function routeStartup($request)
{
global $language, $site_lang;
$path = $this->getPathInfo();
if ($path[0] == '/') {
$path = substr($path, 1);
}
preg_match("/^([a-z]+)\/.*|$/i", $path, $vars);
if (in_array($vars[1], $languages)) {
$site_lang = $var[1];
$path = '/' . substr($path, strlen($var[1]));
$request->setPathInfo($path);
}
}
in that way we have the default router working as usual, and a language
variable set
have fun
--
View this message in context:
http://www.nabble.com/changing-the-url-tp14778862s16154p15173562.html
Sent from the Zend Framework mailing list archive at Nabble.com.