0
votes

I am generating a link (this is for when the language is set as "fre"):

$html->link('About', array('controller' => 'pages', 'action' => 'about', 'language'=> 'fre')) ;

I also have a sub directory for languages [eng|fre] as shown above this can be either languages:

I am routing like so:

Router::connect('/:language/:controller/:action/*',
                   array(),
                   array('language' => 'eng|fre'));

// this worked before the language subdomain
Router::connect('/about',array('controller'=>'pages','action'=>'about'));

the problem I have is, I want the urls to be:

/eng/about
/fre/about

but obviously they are coming out as:

/eng/pages/about
/fre/pages/about
2

2 Answers

1
votes

I think hypothetically this should work

Router::connect('/:language/about',array(
    'controller'=>'pages',
    'action'=>'about',
    'language' => 'eng|fre'
));

EDIT: If all 20 are pages you could try something like

Router::connect('/:language/:action',array(
    'controller'=>'pages',
    'action' => 'about|contact|something|else',
    'language' => 'eng|fre'
));
0
votes

This allows you to use any 3-character language code for any page:

Router::connect(
    '/:language/:controller/:action/*',
    array(),
    array('language'=>'[a-z]{3}')
);