Route Translation with Cakephp

Asked

Viewed 107 times

0

I’m studying Cakephp for possible use in a project, and the crux of this project is that it’s multi-language. Only I’ve done a lot of research on route translation:

  http://projeto.com/contact

  http://projeto.com.br/contato

  http://projeto.es/contacto

But I haven’t found a piece of content that addresses the topic. Someone has that answer? :)

  • 1

    Maybe http://stackoverflow.com/questions/14427391/cakephp-2-x-i18n-route can help you

  • But will I have to register route by route? In other words, my project has about 30 pages and I will have to add the 30 routes there? Thanks for the return.

1 answer

1


If the pages are static, you will have to create one by one. To simplify the process you can do the following:

Controller

public function contact() {
    ...

    $this->render('contact');
    $this->response->send();
    $this->_stop();
}

public function contato() {
    $this->contact(); 
}

public function contacto() {
    $this->contact(); 
}

Viewer

echo $this->Html->link(__('Contact'), array('action' => __('contact')));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.