|
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 contentTo 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 templateThe 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