ZF-8936: Zend Navigation & Zend Translate

Description

I have a error with the following code:

I use the zend application to set up my navigation like here below:

resources.router.routes.tour.route = @tour resources.router.routes.tour.defaults.module = default resources.router.routes.tour.defaults.controller= index resources.router.routes.tour.defaults.action = tour

resources.navigation.pages.main.pages.tour.label = tour resources.navigation.pages.main.pages.tour.module = default resources.navigation.pages.main.pages.tour.controller = index resources.navigation.pages.main.pages.tour.action = tour resources.navigation.pages.main.pages.tour.route = tour

my content is localized, so when i have zend translate doing his translation (using po-files), it works if tour is translated as 'tour' for english and 'rondleiding' for dutch. however, when i translate tour as 'take the tour' for english and 'rondleiding' for dutch, it won't work for english anymore. the url changes to 'take+the+tour', and starts looking for the "take+the+tour" controller

Comments

Assiging to Zend_Controller/Zend_Navigation as component

Note that translation of course looks for "take+the+tour".

It seems that the failure is, that Zend_Controller (or Zend_Navigation) searches for a translated route without normalizing the previously url-ized string.

Eighter the string has to be normalized (case sensitivy could also lead to a problem), or the translation must be done url-ized.

For the second, a note within the manual has to be added.

Better would be to solve the problem within the controller.

Remove Zend_Navigation as affected component, because Zend_Navigation only uses the action url helper. The creation of an URL is outside the control of Zend_Navigation. By the way it is not the task of Zend_Navigation to build URLs. Zend_Translate is only used to translate the page labels.


/**
 * Returns href for this page
 *
 * This method uses {@link Zend_Controller_Action_Helper_Url} to assemble
 * the href based on the page's properties.
 *
 * @return string  page href
 */
public function getHref()
{
    if ($this->_hrefCache) {
        return $this->_hrefCache;
    }

    if (null === self::$_urlHelper) {
        self::$_urlHelper =
            Zend_Controller_Action_HelperBroker::getStaticHelper('Url');
    }

    $params = $this->getParams();

    if ($param = $this->getModule()) {
        $params['module'] = $param;
    }

    if ($param = $this->getController()) {
        $params['controller'] = $param;
    }

    if ($param = $this->getAction()) {
        $params['action'] = $param;
    }

    $url = self::$_urlHelper->url($params,
                                  $this->getRoute(),
                                  $this->getResetParams());

    return $this->_hrefCache = $url;
}