Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
RTL support can be used just having people name their files differently.
If someone wants to implement RTL support, they could name the files as x.css.less
D6 will automatically look for a file named x-rtl.css.less
I think this would be the best solution because it uses existing functionality that is present in D6 and doesn't add any code to the module, other than a couple lines explaining this in README.txt
> RTL support can be used just having people name their files differently.
If I have style.css then Drupal will load style-rtl.css -- you can see this happen in drupal_add_css().
The only difference in the file name is the added "-rtl". The above patch keeps this same logic - for every less file a matching RTL file is loaded (if exists), as core does.
Ok, I now understand. So I think it's worth mentioning this in the README, that the file name should be foo.css.less to let it be overridden by an RTL file (I think it's a good practice also for people who don't do RTL, as they might want to add it in the future).
The code that takes care of detecting and adding entries that handle rtl are handled in a module now where as before it was handled in drupal_get_css().
We can either handle this by checking rtl files in the LESS module or by changing the weight on LESS to run after locale.
Theres another issue i'm having where D7 poor mans cron is being run, but cron_semaphore isnt being properly set, so I was going to change the module weight to handle that problem too, but it would have to be going in the opposite way :/
drupal_cron_run calls module_invoke_all('cron_queue_info'); before it calls module_invoke_all('cron'); , which in turn calls system_cron, which calls module_invoke_all('flush_caches'); .
This in addition to changing the module weight should finally correct the issue with RTL.
Comments
Comment #1
corey.aufang commentedI did a search through D6 source code.
RTL support can be used just having people name their files differently.
If someone wants to implement RTL support, they could name the files as x.css.less
D6 will automatically look for a file named x-rtl.css.less
I think this would be the best solution because it uses existing functionality that is present in D6 and doesn't add any code to the module, other than a couple lines explaining this in README.txt
Let me know if this works for you.
Comment #2
amitaibu> RTL support can be used just having people name their files differently.
If I have style.css then Drupal will load style-rtl.css -- you can see this happen in drupal_add_css().
The only difference in the file name is the added "-rtl". The above patch keeps this same logic - for every less file a matching RTL file is loaded (if exists), as core does.
Comment #3
corey.aufang commentedWhat I'm saying is the patch in unnecessary.
Drupal core does a str_replace looking for ".css" and replacing it with "-rtl.css"
It does this on all files that are grabbed by drupal_get_css()
So instead of using the patch, RTL support can be achieved by using ".css.less" as the file extension instead of just ".less".
There is nothing that needs to be changed in the module.
Comment #4
amitaibuOk, I now understand. So I think it's worth mentioning this in the README, that the file name should be foo.css.less to let it be overridden by an RTL file (I think it's a good practice also for people who don't do RTL, as they might want to add it in the future).
I really like your simple solution.
Comment #5
corey.aufang commentedI'm going to work on a clearer wording for the README and add it soon.
Comment #6
sreynen commentedSounds like this is a documentation issue now.
Comment #7
corey.aufang commentedDocumentation has been added to the README.txt and the project page under compatibility.
This has also prompted a change the the suggested naming of files when has also been noted.
Comment #9
amitaibuIt seems that the 7.x version doesn't support RTL.
in locale_css_alter()
if (file_exists($rtl_path) && !isset($css[$rtl_path])) {is looking for the foo-rtl.css files instead of foo-rtl.css.lessComment #10
corey.aufang commentedThe code that takes care of detecting and adding entries that handle rtl are handled in a module now where as before it was handled in drupal_get_css().
We can either handle this by checking rtl files in the LESS module or by changing the weight on LESS to run after locale.
Theres another issue i'm having where D7 poor mans cron is being run, but cron_semaphore isnt being properly set, so I was going to change the module weight to handle that problem too, but it would have to be going in the opposite way :/
Comment #11
amitaibu> or by changing the weight on LESS to run after locale.
I think that anyway LESS module will have to for rtl files, as we need to create the rtl css files, so locale can include them.
> where D7 poor mans cron is being run, but cron_semaphore isnt being properly set.
Yeah, nasty, I read it here -- http://blog.allyearbooks.co.uk/2011/03/31/race-conditions-and-caching-va...
Comment #12
corey.aufang commentedI found a solution!
drupal_cron_run calls
module_invoke_all('cron_queue_info');before it callsmodule_invoke_all('cron');, which in turn calls system_cron, which callsmodule_invoke_all('flush_caches');.This in addition to changing the module weight should finally correct the issue with RTL.
Comment #13
corey.aufang commentedI just committed a fix to the repo, take a look after the dev gets rolled and let me know if it works for you.
Comment #14
corey.aufang commented