The Joomla! Forum ™






Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: need content manager?
PostPosted: Sat Apr 05, 2008 6:01 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Jan 26, 2007 3:59 pm
Posts: 19
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?


Top
 Profile  
 
PostPosted: Sat Apr 05, 2008 7:06 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Aug 18, 2005 9:58 am
Posts: 10121
Location: Hillerød - Denmark
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
redCOMPONENT Community Manager http://redcomponent.com
Personligt site www.ot2sen.dk
Dansk Joomla! support websted - joomla.dk


Top
 Profile  
 
PostPosted: Sat Apr 05, 2008 7:18 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Jan 26, 2007 3:59 pm
Posts: 19
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.


Top
 Profile  
 
PostPosted: Tue Apr 15, 2008 12:57 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Nov 28, 2006 6:23 pm
Posts: 7
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.


Top
 Profile  
 
PostPosted: Sun May 04, 2008 12:42 pm 
Joomla! Ace
Joomla! Ace

Joined: Sun May 04, 2008 12:37 pm
Posts: 1274
@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!!


Top
 Profile  
 
PostPosted: Tue May 27, 2008 11:42 pm 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 24, 2008 4:29 pm
Posts: 57
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


Top
 Profile  
 
PostPosted: Wed Jun 04, 2008 9:55 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Mar 13, 2008 8:25 pm
Posts: 38
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


Top
 Profile  
 
PostPosted: Wed Apr 11, 2012 11:41 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Dec 21, 2011 10:52 pm
Posts: 20
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 



Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group