Hello to all , this is my fist post.
So , I am creating an app that will support many languages.
The goal is : mysite.com/en/{some route or controller/action}
I have this routes :
'main' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/[:lang]',
'constraints' => array(
'lang' => '[a-zA-Z][a-zA-Z0-9_-]+',
),
'defaults' => array(
//'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Application\Controller\Index',
'action' => 'index',
'lang'=>'en'
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => '[a-zA-Z][a-zA-Z0-9_-]+',
'action' => '[a-zA-Z][a-zA-Z0-9_-]+',
),
'defaults' => array(
),
),
),
/**
* AUTH
*/
'register' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/register',
'defaults' => array(
'controller' => 'Auth\Controller\Index',
'action' => 'register',
),
),
),
'login' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/login',
'defaults' => array(
'controller' => 'Auth\Controller\Index',
'action' => 'login',
),
),
),
'logout' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/logout',
'defaults' => array(
'controller' => 'Auth\Controller\Index',
'action' => 'logout',
),
),
),
So far so good. mysite.com/en/register is working as expected.
The problem is the navigation.
First problem : navigation dont get child_routes as routes.
Second problem : How to tell navigation to set parameter :lang to en(for
example)
My navigation example:
'navigation' => array(
// The DefaultNavigationFactory we configured in (1) uses 'default'
as the sitemap key
'default' => array(
// And finally, here is where we define our page hierarchy
'home' => array(
'label' => 'Register',
'route' => 'register',
'resource'=> 'register'
),
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/ZF2-Multilanguage-Navigation-tp4657979.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]