How can we match the localized URL of 1 single page (in different languages) in 1 route as pattern?
E.g. I would like to act on the page “/en/detailpage”, “/nl/detailpagina”, “/de/detailseite” & “/fr/page-de-detail”. How do I get this into the “pattern” part of the route?
c::set('routes', array(
array(
'pattern' => '??????????????????????',
'action' => function() {
// do something here when the URL matches the pattern above
// and the specified request method
},
'method' => 'GET|POST|DELETE'
)
));
I would like to avoid having a different route for each language with the same “action” into it…
c::set('routes', array(
array(
'pattern' => [
'(:any)/detailpage',
'(:any)/detailpagina',
'(:any)/detailseite',
'(:any)/page-de-detail'
],
'action' => function($language) {
// do something here when the URL matches the pattern above
// and the specified request method
},
'method' => 'GET|POST|DELETE'
)
));
or
c::set('routes', array(
array(
'pattern' => '(:any)/(detailpage|detailpagina|detailseite|page-de-detail)',
'action' => function($language, $id) {
// do something here when the URL matches the pattern above
// and the specified request method
},
'method' => 'GET|POST|DELETE'
)
));