Jason Goh
Jason Goh

Reputation: 1

cakephp multilingual + route

i have two languages to allow user to choose/switch: en or fr

i want the url as:

I do not need cookie.

I do want to split two language folders for all files, except images.

How to make the url route correctly??

I tested the following tutorial, it works fine:

http://bakery.cakephp.org/articles/p0windah/2007/09/12/p28n-the-top-to-bottom-persistent-internationalization-tutorial

But, the language is not appears in the URL. Anyone can help on these?

Thanks.

Upvotes: 0

Views: 751

Answers (1)

Archit Patel
Archit Patel

Reputation: 49

I want to split two language folders for all files, except images.
Answer:
In CakePHP by default Language are given so any user can put many language and for that we need to make a diff.folders for that. And if you don't want to do that, then in all files you can specify specific tag to indicate whether it is "eng" or "fr". For example: en_abc.ctp,fr_abc.ctp.

How to make the url route correctly??
Answer:
By default give "en" in your URL and if any one changes then make it with "fr" and fetch the data from the xml..

Router::connect('/en', array('controller' => 'users', 'action' => 'index/en'));
Router::connect('/fr', array('controller' => 'users', 'action' => 'index/fr'));

and also in index function you can check the variable which is passing if "en" comes then take all data from the English and if "Fr", then take all from the French.. I hope that helps..

Upvotes: 1

Related Questions