Multiple languages in cakephp issue
I am trying to get a multilingual site up according to this tutorial: http://nuts-and-bolts-of-cakephp.com/2008/11/28/cakephp-url-based-language-swi开发者_开发百科tching-for-i18n-and-l10n-internationalization-and-localization/
Things look good in terms that clicking on a switch-language link works. However, when you first come to the site, i would like it to go to the default language example.com/eng/
instaed of just being example.com/
.
Basically, for SEO purposes, I don't want my site to have non-lingual content, should always have the language in the url.
How could I do that and also go through the function that saves the language in session/cookie?
thanx
Looking at the article, all you should need is a simple check for the 'language' param in the URL:
function beforeFilter() {
// check and perform a redirect
if (empty($this->params['language'])) {
$this->redirect(array('language' => 'eng'));
}
// the following method sets any cookies
$this->_setLanguage();
}
精彩评论