The choice to put the RTLized css files under sites/all/modules, as opposed to the original function is not a bad idea at all, and saves a lot of work when extracting the zipped file and maintains the core's modules directories clean (until RTL CSS would be part of core).
However - isn't sites/all/themes a better (i.e. more intuitive) place for those files?

Comments

druvision’s picture

Title: Putting RTL CSS files under sites/all » Automatically load RTL CSS files
Project: Garland BIDI » Drupal core
Version: 5.x-1.x-dev » 6.x-dev
Component: Code » language system

Module-specific RTL CSS files are common to all themes, therefore I am moving this issue to the responsibility for this change from Garland RTL to Drupal's core language system and core theme system. I can't open this issue for both subsystems at once, so I open it for the core language system.

A previous discussion regarding the necessity of RTL CSS files and their location has already been started on issue 56110. Please continue to discuss it here.

To summerize the previous thread:

  • RTL CSS files need to be loaded by Drupal's core, if present.
  • Those files need to be imported automatically if the current page language is RTL.
  • The files were attached to the abovementioned post.
  • The files are identified by the "-rtl.css" suffix.

Currently, the RTL version of the core and contrib CSS files are stored with the RTL extension inside the Garland RTL theme.

We have the following open issues:

  • How do we enable the files to be used by other RTL themes?
  • How to distinguish between core and contrib CSS files?
  • How do we manage versions and releases for those CSS files?
  • What is the naming conversions for the RTL images attached to the CSS files.

Currently, it's sufficient to have manual per-module CSS conversion - we don't have that many CSS files.

Some people asked for automatic CSS conversion. I don't think this is a priority issue. In the future, we may explore the area of automatic RTL conversion of the simple module CSS files, but it's a complex issue and I am not sure that it's needed. A generic perl algorithm with 10-20 rules may be defined, but we need a way to manually override it since it might not cover complex cases and external image references. Also, certain images must be manually converted anyway.

Here are my suggested requirements for RTL theming:

  • RTL language detection should be built into the drupal's theming mechanism.
  • The theming mechanism should automatically load the RTL file of each module if the current language is RTL.
  • The CSS compression facility should be adapted to fetch the direction-specific merged CSS file.

Where to store RTL CSS files?

  • The easiet way is to store them in the module's directory. This is compatible with the way drupal stores the current core & contrib module CSS files. Indeed, there is a permissions issue - the RTL CSS maintainer is different the module maintainer. But - this is a low volume work, since module CSS files are not expected to change alot.
  • Another alternative is to store the files in a separate directory (e.g. /www/misc/css OR /www/includes/css).
Gábor Hojtsy’s picture

The Drupal 6-dev based i18n work is also aimed at solving the management side, so that all languages have LTR/RTL direction information attached. The $locale global variable becomes $language and is getting a 'direction' property, which specifies whether the currently used language is RTL or LTR.

This does not solve the problem of possibly showing multilanguage content on the same page, but it is probably doable to tackle the RTL issue at least first on the page level.

z.stolar’s picture

While it might be possible to identify the correct directionality on each page, it is still needed for core to supply the correct CSS.
Most of the CSS on a Drupal site, in most of the themes, is still coming from core CSS files, and not the theme's style.css file.
So even before showing two languages on the same page, we need to accomodate for bi-directionality support in core.

Gábor Hojtsy’s picture

Indeed, if you provide RTL versions of the core CSS files, and submit patches against the core themes to support RTL languages, then those should get into Drupal core as a basic feature as far as I see. This should not be a contrib addon IMHO (as far as core themes, and getting ready the theme system to support RTL languages).

Gábor Hojtsy’s picture

For your information: Drupal 6.x-dev now has built in support for RTL languages. The RTL languages in the predefined language list were identified by Steven, and marked as such. If you find any omissions, please file an issue with a patch. Now Drupal 6.x-dev has a $language global object, which has a direction property. If it is zero, the language is LTR, if it is one, the language is RTL. Now, themes can make use of this, and CSS can be loaded based on this information. Feel free to base your implementation on this.

Gábor Hojtsy’s picture

Status: Active » Closed (duplicate)

Drupal 6 is getting RTL CSS files in other patches now. Look here for an overview of language issues, including RTL support: http://groups.drupal.org/node/3714 Marking duplicate.

Gábor Hojtsy’s picture

Need people to help test the RTL support fixed in the installer: #1974040: When installing in an RTL language, it should be RTL from profile selection onwards.