Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.410
diff -u -p -r1.410 theme.inc
--- includes/theme.inc	15 Jan 2008 10:43:00 -0000	1.410
+++ includes/theme.inc	15 Jan 2008 17:46:27 -0000
@@ -1740,6 +1740,7 @@ function template_preprocess_page(&$vari
   $variables['head']              = drupal_get_html_head();
   $variables['help']              = theme('help');
   $variables['language']          = $GLOBALS['language'];
+  $variables['direction']         = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
   $variables['logo']              = theme_get_setting('logo');
   $variables['messages']          = $variables['show_messages'] ? theme('status_messages') : '';
   $variables['mission']           = isset($mission) ? $mission : '';
Index: modules/system/maintenance-page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/maintenance-page.tpl.php,v
retrieving revision 1.1
diff -u -p -r1.1 maintenance-page.tpl.php
--- modules/system/maintenance-page.tpl.php	30 Nov 2007 12:19:10 -0000	1.1
+++ modules/system/maintenance-page.tpl.php	15 Jan 2008 17:46:27 -0000
@@ -16,7 +16,7 @@
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $direction ?>">
 
 <head>
   <title><?php print $head_title; ?></title>
Index: modules/system/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/page.tpl.php,v
retrieving revision 1.10
diff -u -p -r1.10 page.tpl.php
--- modules/system/page.tpl.php	8 Dec 2007 14:06:22 -0000	1.10
+++ modules/system/page.tpl.php	15 Jan 2008 17:46:27 -0000
@@ -21,6 +21,7 @@
  * Page metadata:
  * - $language: (object) The language the site is being displayed in.
  *   $language->language contains its textual representation.
+ * - $direction: The language direction. It will either be 'ltr' or 'rtl'.
  * - $head_title: A modified version of the page title, for use in the TITLE tag.
  * - $head: Markup for the HEAD section (including meta tags, keyword tags, and
  *   so on).
@@ -76,7 +77,7 @@
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $direction ?>">
 
 <head>
   <title><?php print $head_title; ?></title>
Index: themes/bluemarine/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/bluemarine/page.tpl.php,v
retrieving revision 1.27
diff -u -p -r1.27 page.tpl.php
--- themes/bluemarine/page.tpl.php	7 Jan 2008 13:49:37 -0000	1.27
+++ themes/bluemarine/page.tpl.php	15 Jan 2008 17:46:27 -0000
@@ -1,7 +1,7 @@
 <?php
 // $Id: page.tpl.php,v 1.27 2008/01/07 13:49:37 goba Exp $
 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language ?>" xml:lang="<?php print $language->language ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language ?>" xml:lang="<?php print $language->language ?>" dir="<?php print $direction ?>">
 
 <head>
   <title><?php print $head_title ?></title>
Index: themes/chameleon/chameleon.theme
===================================================================
RCS file: /cvs/drupal/drupal/themes/chameleon/chameleon.theme,v
retrieving revision 1.75
diff -u -p -r1.75 chameleon.theme
--- themes/chameleon/chameleon.theme	7 Jan 2008 13:49:37 -0000	1.75
+++ themes/chameleon/chameleon.theme	15 Jan 2008 17:46:27 -0000
@@ -14,7 +14,8 @@ function chameleon_theme($existing, $typ
 }
 
 function chameleon_page($content, $show_blocks = TRUE, $show_messages = TRUE) {
-  $language = isset($GLOBALS['language']) ? $GLOBALS['language']->language : NULL;
+  $language = $GLOBALS['language']->language;
+  $direction = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
 
   if (theme_get_setting('toggle_favicon')) {
     drupal_set_html_head('<link rel="shortcut icon" href="'. check_url(theme_get_setting('favicon')) .'" type="image/x-icon" />');
@@ -27,7 +28,7 @@ function chameleon_page($content, $show_
   $blocks_right = theme_blocks('right');
 
   $output  = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
-  $output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$language\" xml:lang=\"$language\">\n";
+  $output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$language\" xml:lang=\"$language\" dir=\"$direction\">\n";
   $output .= "<head>\n";
   $output .= " <title>". ($title ? strip_tags($title) ." | ". variable_get("site_name", "Drupal") : variable_get("site_name", "Drupal") ." | ". variable_get("site_slogan", "")) ."</title>\n";
   $output .= drupal_get_html_head();
Index: themes/garland/maintenance-page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/maintenance-page.tpl.php,v
retrieving revision 1.2
diff -u -p -r1.2 maintenance-page.tpl.php
--- themes/garland/maintenance-page.tpl.php	8 Dec 2007 14:06:23 -0000	1.2
+++ themes/garland/maintenance-page.tpl.php	15 Jan 2008 17:46:27 -0000
@@ -13,7 +13,7 @@
  */
 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $direction ?>">
   <head>
     <title><?php print $head_title ?></title>
     <?php print $head ?>
Index: themes/garland/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/page.tpl.php,v
retrieving revision 1.17
diff -u -p -r1.17 page.tpl.php
--- themes/garland/page.tpl.php	7 Jan 2008 13:49:37 -0000	1.17
+++ themes/garland/page.tpl.php	15 Jan 2008 17:46:27 -0000
@@ -2,7 +2,7 @@
 // $Id: page.tpl.php,v 1.17 2008/01/07 13:49:37 goba Exp $
 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $direction ?>">
   <head>
     <title><?php print $head_title ?></title>
     <?php print $head ?>
Index: themes/pushbutton/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/pushbutton/page.tpl.php,v
retrieving revision 1.24
diff -u -p -r1.24 page.tpl.php
--- themes/pushbutton/page.tpl.php	7 Jan 2008 13:49:38 -0000	1.24
+++ themes/pushbutton/page.tpl.php	15 Jan 2008 17:46:27 -0000
@@ -1,7 +1,7 @@
 <?php
 // $Id: page.tpl.php,v 1.24 2008/01/07 13:49:38 goba Exp $
 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language ?>" xml:lang="<?php print $language->language ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language ?>" xml:lang="<?php print $language->language ?>" dir="<?php print $direction ?>">
 <head>
   <title><?php print $head_title ?></title>
   <meta http-equiv="Content-Style-Type" content="text/css" />
