Page 1 of 1

need content manager?

Posted: Sat Apr 05, 2008 6:01 pm
by v0dk4
Hi all.
I have 2 articles. At the first one, I assigned the italian language, at the second one the english language.
Now, in front page, I want to be displayed the article by the language that was selected: for example, I want to display "1" if user selected italian language, and "2" if user selected english language. How can I do it? Do I need a content manager? I've already installed the languages and I've the module to let the user switch betweeen languages, so I just need a content manager to tell the front page what to display depending on the language chosen?

Re: need content manager?

Posted: Sat Apr 05, 2008 7:06 pm
by ot2sen
Hi v0dk4,

A few weeks ago a new plugin,aLang Plugin (Internationalisation) , was released and published in JED.
Havent had time to test it, but sound like good for your use. Find it here: ... Itemid,35/

In case you need the big solid multilingual solution then the really good news is that Joom!Fish was released in a 1.5 Native version only few days ago.
Find Joom!Fish 2.0 Beta here: ... Itemid,35/

Re: need content manager?

Posted: Sat Apr 05, 2008 7:18 pm
by v0dk4
Hi, I tryed aLang but it is useless: it doesn't change anything to my actual front page. I need a component that modify com_content, because in this component we have frontpage.php, and I need a code in here to tell frontpage to show only articles with italian assigned language, when italian is selected, and the same for english language.
Joomfish is still a beta and I got many errors... that's why I'm asking for another solution.

Re: need content manager?

Posted: Tue Apr 15, 2008 12:57 pm
by shmuel

I have sort of solution to the language issue.

1. /index.php: get the (possible) language request param and put it to session.

Code: Select all

// set the language
if(isset($_REQUEST['lang'])) {
	$options['language'] = $_REQUEST['lang'];
	$_SESSION['lang'] = $_REQUEST['lang'];
} else if(isset($_SESSION['lang'])) {
	$options['language'] = $_SESSION['lang'];
2. /components/com_content/models/article.php: at the end of _buildContentWhere()

Code: Select all

$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: Select all

$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: Select all

$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\"";
$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: Select all

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" />
<?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: Select all

<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.

Re: need content manager?

Posted: Sun May 04, 2008 12:42 pm
by waarnemer

Thankx man! Your method in combination with m17n works perfectly for me..

I've implemented step 1, 2 and 3 and in combination with above mentioned m17n component ist works like a charm..

Ok, ok i've just found out and I'm still thrilled and no long testing has been done...but for the moment...


Re: need content manager?

Posted: Tue May 27, 2008 11:42 pm
by grvulture
shmuel, I TOTALLY second that your code should be joomla core code on next release!

perharps the modules part is kind of weird, and needs to be something different, but everything else, absolutely joomla core stuff!

Hopefully it's there on next release! and the front-end language selector should be a core-module on next release also.

Thank you for this fabulous and straight-forward way of implementing multi-lingual functionality!

Re: need content manager?

Posted: Wed Jun 04, 2008 9:55 pm
by luckydog83
Do you have a way for a technically-challenged person to implement these code changes??? Or do I need to hire someone?

Re: need content manager?

Posted: Wed Apr 11, 2012 11:41 pm
by BaptisteG
Thank you man, that was exactly what I needed. I just used the 1. 2. and 3. and everything worked like a charmed. I've been looking for this for a while, so thank you again.