for multi language sites there RTL css files are not loaded
As for drupal 5, in order to load the correct css file according to the language
we have set a small file load_rtl_core_css.php that check if there is RTL version of the css and load it insted of the regular file

all you need to do is replace

<?php print $styles; ?>  

in page.tpl.php with

<?php include_once 'load_rtl_core_css.php'; ?> 

here is the code

<?php
    $rtl_langs = array("ar", "fa", "he", "ur", "yi"); // There are a couple or so more. Put the codes of your RTL languages here
    if (in_array ($language, $rtl_langs)) { // Check if the language of the current page is RTL.
      /* Load RTL styles instead of default ones: */
      foreach($css as $media => $types){
        foreach($types as $type => $files){
          foreach($files as $file => $preprocess){
            $element = $file;
            $rtl_style = str_replace(".css","-rtl.css",$file);
            if(file_exists($rtl_style)){
              unset($css[$media][$type][$file]);
              $css[$media][$type][$rtl_style] = $preprocess;
            }
          }
        }
      }
      print drupal_get_css($css);
  	} else {
      print $styles;
  	}
  ?>

see here more themes that use this method
http://groups.drupal.org/node/13826

Comments

yhager’s picture

Why not just add this code to _phptemplate_variables() in template.php, and modify $styles there, so the tpl itself would stay clean?

tombigel’s picture

I don't think i'm going to add this. Things worked fine till now, and everything can be overridden by style-rtl.css
Besides, I don't want to invest time on the Drupal 5 version anymore, and this may break things and force me to edit and test my CSS files.

What I do want is some help with creating a small function for template.php that will produce something like $language -> direction so I can ditch i18n dependency in Tendu for Drupal 5 and make one last commit for this version.

avior’s picture

Hi Tom
I think that the reason that you didn't here about that before is, that people does not use this theme in a multi lingual site so the style files of your theme provided a override of the "problematic" styles (if there were such)

there is a reason that there are core RTL files, so unless you provide the RTL override of all the styles in your theme RTL version , i think you should add this fix

I can testify that missing core RTL file in one of the multi lingual sites i have, cause some of the buttons to float to the wrong direction , and partially covered by other objects so they couldn't be clicked

the method does not matter , you can add this in template.php as Yuval wrote or as the sample i have sent, this method is used by some of the multi lingual themes in drupal.org.il

tombigel’s picture

Priority: Normal » Minor

I downstreamed Tendu for D6 fixes into the D5 version.
Added a "lagnuage_dir" function and page.tpl variable.

Not going to touch this version anymore unless serious bugs will be found.

tombigel’s picture

Status: Active » Postponed
tombigel’s picture

Status: Postponed » Fixed

Fixed the issue with some help from Amnon Levav

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.