TextDomain我跟着這個link的指示成功,現在我的網站是沒有在「平移,()」電話,要求放「區域」多語言。 但我必須把每次我稱之爲TextDomain。Zend框架2設置在onBootstrap
$this->traslate("Hello", __NAMESPACE__) //where __NAMESPACE__ is the text domain.
我想設置TextDomain在onBootstrap方法,而不是把它放在了「平移,()」幫手的每次調用。 我已經嘗試過使用setTextDomain方法,但它不存在。 有人知道它是如何做到的?
的onBootStrap守則如下:
.....//Code for define $locale.
$sm = $e->getApplication()->getServiceManager();
$translator = $sm->get('translator');
$translator->setLocale($locale);
$traslator->SetTextDomain($textdomain); //This line not work!!!!!
這是複製和粘貼?因爲在這種情況下,它使某種意義上說,它不會工作OT)'$ traslator' =>'$ translator'和'SetTextDomain()'=>'setTextDomain()' – Sam
喔對不起。這是一個寫入錯誤(不要複製和粘貼)。我也看過zend API文檔,這種方法不存在。 – josepmra