开发者

Disable translation of Zend_Navigation elements

开发者 https://www.devze.com 2023-02-04 18:44 出处:网络
Is there any easy way to disable translation of some of the Zend Navigation elements? e.g. in this case

Is there any easy way to disable translation of some of the Zend Navigation elements?

e.g. in this case

$page = new Zend_Navigation_Page_Mvc(
  开发者_StackOverflow社区  array(
        'label' => $blogPost->alreadyTranslatedTitleFromDb
        // ... 
    )
);

$container->addPage($page);

Now, when I use:

$page->getLabel();

the label is translated twice. The same for breadcrumbs, sitemaps etc.


I wrote a patch with unit tests for this:

  • http://framework.zend.com/issues/browse/ZF-10948


If you want only some specific elements to be disabled, i think that only way is to use a partial view script and create your own logic for the menu.

You may add custom properties to the pages. Example: add a property doNotTranslate and in your view script check for this property to know if element should be translated or not.

More info about partial view script is available at http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.navigation.menu

0

精彩评论

暂无评论...
验证码 换一张
取 消