need content manager?

General questions regarding the use of languages in Joomla! 1.5.

Moderator: General Support Moderators

Locked
v0dk4
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Fri Jan 26, 2007 3:59 pm

need content manager?

Post by v0dk4 » Sat Apr 05, 2008 6:01 pm

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?

User avatar
ot2sen
Joomla! Master
Joomla! Master
Posts: 10381
Joined: Thu Aug 18, 2005 9:58 am
Location: Hillerød - Denmark
Contact:

Re: need content manager?

Post by ot2sen » Sat Apr 05, 2008 7:06 pm

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:
http://extensions.joomla.org/component/ ... 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:
http://extensions.joomla.org/component/ ... Itemid,35/
Ole Bang Ottosen
Dansk frivillig Joomla! support websted - joomla.dk
OpenTranslators Core Team opentranslators.org

v0dk4
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Fri Jan 26, 2007 3:59 pm

Re: need content manager?

Post by v0dk4 » Sat Apr 05, 2008 7:18 pm

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.

shmuel
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Tue Nov 28, 2006 6:23 pm

Re: need content manager?

Post by shmuel » Tue Apr 15, 2008 12:57 pm

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: 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'];
}
$mainframe->initialise($options);
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\"";
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: 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" />
	</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: 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.

waarnemer
Joomla! Hero
Joomla! Hero
Posts: 2954
Joined: Sun May 04, 2008 12:37 pm

Re: need content manager?

Post by waarnemer » Sun May 04, 2008 12:42 pm

@shmuel

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

Thanks!!

grvulture
Joomla! Intern
Joomla! Intern
Posts: 60
Joined: Thu Apr 24, 2008 4:29 pm

Re: need content manager?

Post by grvulture » Tue May 27, 2008 11:42 pm

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!
grvulture

luckydog83
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Thu Mar 13, 2008 8:25 pm

Re: need content manager?

Post by luckydog83 » Wed Jun 04, 2008 9:55 pm

Do you have a way for a technically-challenged person to implement these code changes??? Or do I need to hire someone?
A U.S. city with no school, in 2008? Let's change it! http://www.oakgrove-academy.org

BaptisteG
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Wed Dec 21, 2011 10:52 pm

Re: need content manager?

Post by BaptisteG » Wed Apr 11, 2012 11:41 pm

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.


Locked

Return to “Language - Joomla! 1.5”