Spice up your Joomla and Mambo website with 2 great extensions!
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

38931 Posts in 10542 Topics by 27629 Members
Latest Member: VL
JoomlaWorks Community ForumTutorials contributed by usersFor Joomla! 1.0.xJoom!Fish tip: Show different content on language change!
Pages: [1]   Go Down
  Print  
Author Topic: Joom!Fish tip: Show different content on language change!  (Read 15162 times)
0 Members and 1 Guest are viewing this topic.
Fotis
JoomlaWorks Team / Forum Administrator
Administrator
Hero Member
*****
Offline Offline

Posts: 3966


K2 wins "Joomla! component of 2010" at J & Beyond!


View Profile WWW
« on: June 09, 2007, 04:44:10 AM »

You've setup a multilingual website using Joomla! and Joom!Fish to translate your content between languages. For some reason however, you want to offer your users the ability to experience different content -like banners- depending on the selected language. So what is the easiest way to do something like that?

Let's assume we offer our content in 2 languages, English and French. We open up our template's index.php file and locate where this change should occur, e.g. in the place of a current module position:

Code:
<?php mosLoadModules ('banner_en',-1); ?>

We change this to the following:

Code:
<?php
if ($mosConfig_lang == 'english' ) {
  
mosLoadModules ('banner_en',-1);
} else if {
if (
$mosConfig_lang == 'french' ) {
  
mosLoadModules ('banner_fr',-1);
} else { 
// default - if no language is defined for some reason
  
mosLoadModules ('banner_en',-1);
}
?>


Got it?  Cheesy

Now, note down this: you CAN use this tip to even pass different CSS files to the browser or even images depending on the selected language!
« Last Edit: June 09, 2007, 04:57:02 AM by Fotis Evangelou » Logged

Frontpage Slideshow! The uber slideshow system for Joomla! & other PHP based sites by JoomlaWorks

Thinking of blogging with Joomla? Try SuperBlogger!

BREAKING NEWS! K2 has won the "Joomla! component of 2010" award at J and Beyond 2010, the international Joomla! event
no64
Jr. Member
**
Offline Offline

Posts: 26


View Profile
« Reply #1 on: March 10, 2008, 12:48:15 PM »

You could also do something similar  with images/graphics placed in your layout.

Code:

<img src="this-is-your-image-path/<?php echo strtolower($mosConfig_lang);?>_myImage.png" alt="" border="0" height="30" width="160" />

and then make different images for each language, like:

german_myImage.png
english_myImage.png
etc.

the filename of the image has to have the "language" name at the beginning.

 

Logged

Signatures appear only for members with more than 10 posts
no64
Jr. Member
**
Offline Offline

Posts: 26


View Profile
« Reply #2 on: March 10, 2008, 12:53:41 PM »

... or with hardcoded Textitems:

Code:

<ul>
<li>
                           <a href="#"><?php $translation = array('german' => 'Suchen''english' => 'Search''french' => 'Cherche'); echo $translation[strtolower($mosConfig_lang)]; ?></a>
</li>
</ul><!-- hardcoded menuitem -->


Logged

Signatures appear only for members with more than 10 posts
jona37
Newbie
*
Offline Offline

Posts: 3


View Profile Email
« Reply #3 on: August 06, 2008, 03:22:29 AM »

would this be possible to use in content?

If so would solve some translation problem in frontpage component.

thanks
Logged

Signatures appear only for members with more than 10 posts
Burhank
Newbie
*
Offline Offline

Posts: 3


View Profile
« Reply #4 on: June 06, 2009, 08:16:18 PM »


DRUPAL HELP PLEASE !!

Hello,
Is it possible to let me know how to do it on Drupal ??!
I've been searching the whole forum and the web for an answer and its weird that no one mentioned it !! Is it only me ??!

I did modify line 361 in  fpss.module to ignore the node category because the whole slide module crash when enabling the translating tool. Its like there is no field for the language in the module so what i did is ignored the category. I hope you can get what I mean and please create a whole comprehensive module for drupal not just the static thingy. Thank you so much.

God bless you
Logged

Signatures appear only for members with more than 10 posts
287d
Newbie
*
Offline Offline

Posts: 2


View Profile Email
« Reply #5 on: June 22, 2009, 01:08:37 AM »

Hi Guys,

thanks for the tip. I used this in my template as follows:
Code:
<script type="text/javascript" src="templates/<?php echo $this->template ?>/js/<?php echo strtolower($mosConfig_lang);?>_date.js">

and it works fine to translate the date depending in language however only in legacy mode (using j1.5).

I had installed a plugin that only worked in legacy and now I am not using it so I though I would disable legacy but when I do my date.js does not load.
Any ideas?

Thanks.

A
Logged

Signatures appear only for members with more than 10 posts
287d
Newbie
*
Offline Offline

Posts: 2


View Profile Email
« Reply #6 on: June 22, 2009, 01:38:31 AM »

ok i sorted it for anyon ethat may have the same issue. using:
Code:
<script type="text/javascript" src="templates/<?php echo $this->template ?>/js/<?php echo $this->language ?>_date.js">

worked. and having en-gb_date.js and es-es_date.js as the files.

note just es_date and en_date did not work!
Logged

Signatures appear only for members with more than 10 posts
Pages: [1]   Go Up
  Print  
 
Jump to: