Revision #5 has been created by c@cba on Dec 30, 2011, 12:59:57 AM with the memo:
You have a multilingual application, and you want the URL of a page to be different for different languages
« previous (#4)
Changes
Title
unchanged
SEO-conform Multilingual URLs + Language Selector Widget (i18n)
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
multilanguage, language, seo, i18n, widget
Content
changed
[...]
if(sizeof($languages) < 4) {
// Render options as links
$lastElement = end($languages);
foreach($languages as $key=>$lang) {
if($key != $currentLang) {
echo CHtml::link($lang,
$lang,
$this->getOwner()->createMultilanguageReturnUrl($key));
} else echo '<b>'.$lang.'</b>';
if($lang != $lastElement) echo ' | ';[...]
else {
// Render options as dropDownList
// Use: CHtml::form($action='', $method='post', $htmlOption=array())
echo CHtml::form();
// for each language, add a hidden field with the MultilanguageReturnUrl for that language. echo CHtml::form();
foreach($languages as $key=>$lang) {
echo CHtml::hiddenField(
$key,
$key,
$this->getOwner()->createMultilanguageReturnUrl($key));
}
echo CHtml::dropDownList('language', $currentLang, $languages,
array(
'submit'=>'',
)[...]