Style not loaded at all if lang is not RTL

yhager - March 13, 2007 - 08:42
Project:Garland BIDI
Version:5.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

When installing the module, if the selected language is not RTL, no style is being loaded.

As a workaround, enable the locale module, and install an RTL (e.g. Hebrew) language, and select it.

#1

gilf - April 1, 2007 - 20:27

As a workaround, enable the locale module, and install an RTL (e.g. Hebrew) language, and select it.

Does not work for me. looking at the page source in English (EN) no styles appear. In Hebrew (HE) I get the correct *-ltr.css styles.
I am using the localization (http://drupal.org/project/i18n) module. Echoing the $language var to the screen shows the correct language.

I am note a coder, but something seems to be missing from the ELSE statment in line 132 of template.php.
I added the following block :

<?php
   
foreach($css as $media => $types){
      foreach(
$types as $type => $files){
        foreach(
$files as $file => $preprocess){
         
$element = $file;
         
// Try to locate the RTL  style in the theme's directory. If not found, try to find it in the same directory as the original file.
         
$rtl_style = $directory . '/css/' . str_replace(".css","-ltr.css",basename($file));
          if (!
file_exists ($rtl_style)) {
           
$rtl_style = dirname ($file) . '/' . str_replace('.css','-ltr.css',basename($file));
          }
          if(
file_exists($rtl_style)){
            unset(
$css[$media][$type][$file]);
           
// tell drupal_get_css to preprocess it
           
$css[$media][$type][$rtl_style] = $preprocess;
          }
        }
      }
    }
    print
drupal_get_css($css);
?>

Which is almost a verbatim copy of the previous statement.
I now get a style sheet, but overall orientation is still RTL

 
 

Drupal is a registered trademark of Dries Buytaert.