Drupal 7 page template for right to left languages e.g. page--rtl.tpl.php Trying to create a custom page.tpl dependant on language or 'right to left' support, here is what i have so far.

function THEMENAME_preprocess_page(&amp;$variables) {
    if($variables['language']-&gt;language == 'ar') {
      $variables['template_file'] = 'page--ar';
    }
}


Am i on the right track?
In Drupal 7, what you'll want to do is something along these lines:

function THEMENAME_preprocess_page(&amp;$variables) {
  if($variables['language']-&gt;language == 'ar') {
     $variables['theme_hook_suggestions'][] = 'page__ar';
  }
}


which will cause Drupal to look for a page--ar.tpl.php file (or even a THEMENAME__page__ar() function, which is the reason for the underscores in the variable value btw) when $language is set to ar.

A possible enhancement:

function THEMENAME_preprocess_page(&amp;$variables) {
  if(isset($variables['language'])) {
     $variables['theme_hook_suggestions'][] = 'page__' . $variables['language']-&gt;language;
  }
}


will cause Drupal to look for page--XX.tpl.php files and will use them if they exist; otherwise, will just keep looking for a less specific template and will end up using page.tpl.php.  This way, you don't have to have a lot if's in your preprocess logic.

For that matter, you can also do something like this:

function THEMENAME_preprocess_page(&amp;$variables) {
  if(isset($variables['language']) &amp;&amp; $variables['language']-&gt;dir=='rtl') {
     $variables['theme_hook_suggestions'][] = 'page__rtl';
  }
}


and now you would have one page--rtl.tpl.php file for all rtl languages.

Lots of possibilities abound here, a quick:

drupal_set_message('&lt;pre&gt;' . print_r($variables['language'], TRUE) . '&lt;/pre&gt;');


in the beginning of your preprocess function will show you what you have to work with.