Reputation: 1
i have two languages to allow user to choose/switch: en or fr
i want the url as:
xxx.com/en/ --> default language is en
xxx.com/en/stock/stockName1/ -> dynamic page in EN language, it is similar to xxx.com/stock.php?lang=en&stockid=123
xxx.com/fr/stock/stockName1/ -> dynamic page in FR language
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:
But, the language is not appears in the URL. Anyone can help on these?
Thanks.
Upvotes: 0
Views: 751
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