0
ZF1을 사용하여 다국어 웹 사이트를 구축하고 있습니다. 모든 것은 zend navigation과 함께 다중 언어 부분 인 1 가지를 기대합니다. 개발 페이지의 URL을 열면 표준 언어는 영어 (http://website.nl/en)입니다. 탐색 표시 줄 (zend 탐색 기반)은 다음과 같은 URL을 표시합니다./en/blog,/en/events 등. 그러나 영어에서 네덜란드어 (http://website.nl/nl)로 언어를 변경하면 탐색 모음 stil/en/home,/en/블로그 등Zend Navigation and Zend Locale
누군가가 문제를 알고 있습니까?
Routingcode :
// Routing
$front = Zend_Controller_Front::getInstance();
// Remove default router
$router = $front->getRouter();
$router->removeDefaultRoutes();
// Add routers from config
$config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/routes.xml');
$router->addConfig($config, 'routes');
네비게이션 코드 : 라우팅 XML의
$this->bootstrap('layout');
$this->bootstrap('view');
$layout = $this->getResource('layout');
$view = $layout->getView();
// Set path to navigation.xmls
$config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml');
// ACL
$acl = new Application_Model_Acl();
// Get the identity of the user
$auth = Zend_Auth::getInstance()->getIdentity();
$navigation = new Zend_Navigation($config);
$view->navigation($navigation)
->setAcl($acl)
->setRole($auth->role);
부
<cameloth type="Zend_Controller_Router_Route_Hostname">
<route>websiteurl</route>
<defaults _layout="sitecameloth/layout" module="siteCameloth" />
<chains>
<locale>
<route>:locale</route>
<defaults controller="index" locale="en" />
<reqs locale="[a-z]{2,3}" />
<chains>
<index>
<route></route>
<defaults _layout="sitecameloth/front" action="index" />
</index>
<news>
<route>blog</route>
<defaults controller="news" />
<chains>
<list>
<route>:page</route>
<defaults action="list" page="1" />
</list>
<read>
<route>:id/:title</route>
<defaults action="read" />
</read>
</chains>
</news>
로케일 플러그인
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$lang = $request->getParam('locale', '');
if ($lang !== 'en' && $lang !== 'nl')
$request->setParam('locale', 'en');
$lang = $request->getParam('locale');
if ($lang == 'en')
$locale = 'en_US';
else
$locale = 'nl_NL';
$zl = new Zend_Locale();
$zl->setLocale($locale);
Zend_Registry::set('Zend_Locale', $zl);
$translate = new Zend_Translate('gettext', APPLICATION_PATH . '/languages/' . $locale . '.mo');
Zend_Registry::set('Zend_Translate', $translate);
}
는
당신은 당신이에 거 알아 * 틀린 * 젠드 프레임 워크;) – markus