As title suggests, RTL is loaded when needed.

CommentFileSizeAuthor
rtl-less.patch2.88 KBamitaibu

Comments

corey.aufang’s picture

I 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.

amitaibu’s picture

> 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.

corey.aufang’s picture

What 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.

amitaibu’s picture

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).

I really like your simple solution.

corey.aufang’s picture

I'm going to work on a clearer wording for the README and add it soon.

sreynen’s picture

Component: Code » Documentation
Status: Needs review » Active

Sounds like this is a documentation issue now.

corey.aufang’s picture

Status: Active » Fixed

Documentation 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.

Status: Fixed » Closed (fixed)

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

amitaibu’s picture

Title: Add RTL support » RTL support
Version: 6.x-2.x-dev » 7.x-2.x-dev
Component: Documentation » Code
Category: feature » bug
Status: Closed (fixed) » Active

It 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.less

corey.aufang’s picture

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 :/

amitaibu’s picture

> 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...

corey.aufang’s picture

I found a solution!

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.

corey.aufang’s picture

Status: Active » Needs review

I just committed a fix to the repo, take a look after the dev gets rolled and let me know if it works for you.

corey.aufang’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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