The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sat Apr 21, 2012 2:19 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Apr 21, 2012 2:14 am
Posts: 28
Hello!

How do I put a character between the languages in the language switcher? I didn't find the way to do it.
At the moment the languages are displayed on my site like that:

ITALIANO DEUTSCH

What I want to achieve is a seperator between like that:

ITALIANO | DEUTSCH

Where can I change this setting?


Top
 Profile  
 
PostPosted: Sat Apr 21, 2012 9:11 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16641
Location: **Translation Matters**
1. Make sure the Title Native of Content Languages are Uppercase.

2. Set the Language Switcher module(s) parameters to:
Attachment:
Picture 63.jpg

3. Duplicate the file:
JOOMLAROOT/modules/mod_languages/tmpl/default.php
and place it in
YOURTEMPLATE/html/mod_languages/
(if the html folder does not exist, create it)

4. Edit this file in a text editor by adding after line 11 the following code (in bold below):
Quote:
JHtml::_('stylesheet', 'mod_languages/template.css', array(), true);


$doc = JFactory::getDocument();
$modlangcss1 = "div.mod-languages li {border-left: 1px solid; padding-left: 0.6em; padding-right: 0.3em; margin:0;}";
$doc->addStyleDeclaration($modlangcss1);
$modlangcss2 = "div.mod-languages li.first {border-left:none; padding-left: 0;}";
$doc->addStyleDeclaration($modlangcss2);

?>
<div class="mod-languages<?php echo $moduleclass_sfx ?>">

Modify the css to fit your design.

Then change
Code:
<?php foreach($list as $language):?>
      <?php if ($params->get('show_active', 0) || !$language->active):?>
         <li class="<?php echo $language->active ? 'lang-active' : '';?>" dir="<?php echo JLanguage::getInstance($language->lang_code)->isRTL() ? 'rtl' : 'ltr' ?>">
         <a href="<?php echo $language->link;?>">

to
Code:
<?php foreach($list as $language):?>
      <?php if ($language === reset($list)):?>
      <?php $first = " first";?>
      <?php else:?>
      <?php $first = "";?>
      <?php endif;?>
      <?php $lang_active = "lang_active";?>
      <?php if ($params->get('show_active', 0) || !$language->active):?>
         <li class="<?php echo $language->active ?  $lang_active .$first : $first;?>" dir="<?php echo JLanguage::getInstance($language->lang_code)->isRTL() ? 'rtl' : 'ltr' ?>">
         <a href="<?php echo $language->link;?>">

This should work. The advantage of this type of code is that it will not be overwritten when you update Joomla.
If you use RTL languages, this would have to be adapted.

Here is a a zip of the file, if it is easier for you.
Attachment:
default.php.zip


You do not have the required permissions to view the files attached to this post.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Sat Apr 21, 2012 9:29 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Apr 21, 2012 2:14 am
Posts: 28
Thank you! That's very very kind of you. I'm going to try it.

Greetings from Italy! :)


Top
 Profile  
 
PostPosted: Tue Apr 24, 2012 12:15 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Apr 21, 2012 2:14 am
Posts: 28
A question: where is the line in the code who adds the vertical line "|" ?
I looked inside the html and I can't see it. I tried to understand the PHP code and I didn't neither find the line where the vertical line is added. I must admit I'm a beginner with PHP...

Another question: Is there a reason why every PHP code line has to be opened and closed with "<?PHP" and "?>" instead of putting "<?PHP" at the beginning and "?>" at the end of the PHP code like in the head part?

Thanks in advance!

Ciaooo! :-)


Top
 Profile  
 
PostPosted: Tue Apr 24, 2012 9:46 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16641
Location: **Translation Matters**
You can also
cryptbear wrote:
A question: where is the line in the code who adds the vertical line "|" ?
I looked inside the html and I can't see it. I tried to understand the PHP code and I didn't neither find the line where the vertical line is added. I must admit I'm a beginner with PHP...


The | is a border defined in the css
border-left: 1px

Quote:
Another question: Is there a reason why every PHP code line has to be opened and closed with "<?PHP" and "?>" instead of putting "<?PHP" at the beginning and "?>" at the end of the PHP code like in the head part?


You also can do. Then you will have to add the } and {
Best pratice is to separate all php that way when you get some html tag in a template-type file (default.php is one)

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Fri Aug 24, 2012 7:24 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Oct 11, 2011 12:02 pm
Posts: 11
Hello, thanks for this great thread, really helped me !

Is there however a way to control the height of the separator or border ?

The reason is that I have a menu on the side of the language switcher that has menu separators that are about 12 px of height but the separator in the language switcher is about 16 px. I know it isn't a big thing but if there is a quick way about it it's worth a shot right ?


Top
 Profile  
 
PostPosted: Sat Aug 25, 2012 6:33 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16641
Location: **Translation Matters**
A border line picks the dimensions of the element concerned, in this case a height of 16px. No way to change this easily. You may want to post this question on a CSS specialised site.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Sat Aug 25, 2012 10:56 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Oct 11, 2011 12:02 pm
Posts: 11
Ok, thanks though for the answer ;)


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