Home Documentation General Docs How to use language dependent images?
How to use language dependent images? PDF Argraffu Ebost
Ysgrifennwyd gan Ivo Apostolov   
Dydd Mercher, 25 Ebrill 2007 22:36
NO TRANSLATION AVAILABLE

Using language depended images referes to two different sections:

  • Images within content
  • Images or styles within the template

A related topic is the use of different styles or layouts in a template.
It is generally adviced to use different directories for the different language related images or styles.

Images within content

To change the images within the translated content you can use the additional image files. The translatable fields are not handled like in the standard content dialog, but you can easily copy the original values and change the name of the image in the text field.

Images or styles within the template

The easiest way to handle this issue is to make the template aware of the posiible languages. This can be handled by adding either a reference to $mosConfig_lang or $iso_client_lang to the template image code or style sheet.

Within a template this can look like:

<?php

$template = 'template_css.css';

$langTemplate = 'template_' .$GLOBALS['mosConfig_lang']. '_css.css';

if( files_exists( $mosConfig_live_site .'/templates/rhuk_solarflare_ii/css/' . $langTemplate ) )

{ $template = $langTemplate;}?><link href="<?php echo $mosConfig_live_site;?>/templates/

rhuk_solarflare_ii/css/<?php echo $template;?>" rel="stylesheet" type="text/css" />

This code loads the language depended Style Sheet as long a file like template_german_css.css exists.

You can do something similar with your image tags, here it is adviced to use different directories such as:

<?php

$imageDir = $mosConfig_live_site . '/templates/rhuk_solarflare_ii/

images';$langImageDir = '/' . $GLOBALS['mosConfig_lang'];if( dir_exists(

$imageDir . $langImageDir ) ) { $imageDir = $imageDir . $langImageDir;}?>

<img src="<?php echo $imageDir;?>/myimage.png">

 

0 Comments

Add Comment

Joom!Fish 2.0 RC download

Selected Contributors

From the Joom!Fish Core team (Alex, Geraint, Ivo & Robin) a big thank you to all the people of the JoomFish community!
Special thank's for testing, good suggestions, translations and forum moderation to:

  • Tommy White for the cute logo design
  • Bernhard, Michael, Luc, Olivier, Robin, Rune, Akarawuth
  • Harri <aka tassu> for moderation

Recommended Reading

Buy Joomla! 1.5 with directshopper