2016-04-08 53 views
1

根據knp,this應該是如何輕鬆地將翻譯添加到菜單中。它不適合我。 我的菜單類:Knp菜單翻譯

public function createMainMenuLeft(array $options) 
    { 
     $menuLeft = $this->factory->createItem('root', array('childrenAttributes' => array('class' => 'left'))); 

     $menuLeft->addChild('test', array('route' => 'test_route')) 
      ->setExtra('translation_domain', 'AppBundle'); 

     return $menuLeft; 
    } 

在的appbundle /資源/翻譯/ messages.en.yml我

test: nothing 

然而,我的菜單仍然有標籤「測試」不翻譯的價值文件。我在這裏錯過了什麼嗎?

我的語言環境設置爲config.ymlen

+0

您是否嘗試過不設置額外的翻譯域? – Matteo

+0

@Matteo是的,我做到了。不工作 – Matt

回答

2

經過一番研究,我找到了從包中獲取文檔的方法,而不是從symfony獲得的。模板已被覆蓋。 Source