2012-11-08 128 views
0

根據目前Translation Documentation,Symfony2中查找消息文件(即翻譯)在以下位置:Symfony2的翻譯

the <kernel root directory>/Resources/translations directory; 
the <kernel root directory>/Resources/<bundle name>/translations directory; 
the Resources/translations/ directory of the bundle. 

有沒有辦法迫使Symfony2中尋找到

the <kernel root directory>/Resources/translations/mydirectory directory; 

回答

0

你必須編寫自己的翻譯裝載機Symfony\Component\Translation\Loader\LoaderInterface並用translation.loader對其進行標記。

您的翻譯人員必須執行loadMessages($directory, MessageCatalogue $catalogue)方法。

您可以實現它作爲 $this->symfonyLoader->loadMessages($directory."/subdir", $catalogue);

可以使用DI容器

通過 $this->symfonyLoader