Hi,
I have sort of solution to the language issue.
1. /index.php: get the (possible) language request param and put it to session.
Code:
// set the language
if(isset($_REQUEST['lang'])) {
$options['language'] = $_REQUEST['lang'];
$_SESSION['lang'] = $_REQUEST['lang'];
} else if(isset($_SESSION['lang'])) {
$options['language'] = $_SESSION['lang'];
}
$mainframe->initialise($options);
2. /components/com_content/models/article.php: at the end of _buildContentWhere()
Code:
$config =& JFactory::getConfig();
$language = $config->getValue('config.language');
$where .= " AND a.attribs like '%language=" . $language . "%' ";
return $where;
3. Same thing for /components/com_content/models/frontpage.php: at the end of _buildContentWhere()
Code:
$config =& JFactory::getConfig();
$language = $config->getValue('config.language');
$where .= " AND a.attribs like '%language=" . $language . "%' ";
return $where;
4. In template index.php add the language selector:
Code:
$language = $mainframe->getCfg('language');
$address = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if(strstr($address, 'lang=')) {
$address = preg_replace("/[?&]lang=\w\w-\w\w/", '', $address);
}
$address .= strstr($address, '?') ? "&" : "?";
$attribs = " onchange=\"if(this.options[this.selectedIndex].value == '') { return false; } window.location.href='" . $address . "lang=' + this.options[this.selectedIndex].value\"";
jimport('joomla.language.helper');
$languages = JLanguageHelper::createLanguageList($mainframe->getCfg('language'));
$name = 'lang';
array_unshift($languages, JHTML::_('select.option', '', '- '.JText::_('Select Language').' -'));
echo JHTML::_('select.genericlist', $languages, $name, 'class="inputbox"' . $attribs, 'value', 'text', $language);
5. In that same file add the language specific modules like this for example:
Code:
global $mainframe;
$language = $mainframe->getCfg('language');
if ( ($this->countModules('left') || $this->countModules('left-' . $language)) && JRequest::getCmd('task') != 'edit' ) { ?>
<td valign="top" width="215" class="vistaleft">
<?php if ( $this->countModules('left-' . $language) && JRequest::getCmd('task') != 'edit' ) { ?>
<jdoc:include type="modules" name="left-<?php echo $language; ?>" style="rounded" />
<?php } ?>
<jdoc:include type="modules" name="left" style="rounded" />
</td>
<?php } ?>
6. Add modules for each language and set their titles in their respective languages. Publish the modules in the language you want, i.e. left-en-GB, bottom-f-FI, etc.
7. When you create content use the Advanced parameters to set their language as desired. Remember to install a language pack for each language in which you want to show the content. Also you can create Sections and Categories for your content. You could have a Section and a Category called "main" where you can place your English content and "glavnii" for Russian etc.
This solves the language issue for most part. Still have to figure something for banners. I could add a language selection to the com_banners.
I think that the language selection should be essential built-in part of the Joomla core and modules and even the meta info in config.
Ideal would be something like this:
Code:
<jdoc:include type="modules" name="left" language="en-GB" />
That way I wouldn't need to do any of this hassle.
This is just a temporary solution until JoomFish! 2 will be steady enough.