diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module
index 103c284..e818841 100644
--- a/core/modules/locale/locale.module
+++ b/core/modules/locale/locale.module
@@ -1175,3 +1175,21 @@ function locale_form_system_file_system_settings_alter(&$form, $form_state) {
     $form['file_default_scheme']['#weight'] = 20;
   }
 }
+
+/**
+ * Implements MODULE_preprocess_HOOK().
+ */
+function locale_preprocess_node(&$variables) {
+  if ($variables['language'] != LANGUAGE_NONE) {
+    global $language;
+
+    $node_language = language_load($variables['language']);
+    if ($node_language->language != $language->language) {
+      $variables['attributes_array']['lang'] = $variables['language'];
+      if ($node_language->direction != $language->direction) {
+        $dir = array('ltr', 'rtl');
+        $variables['attributes_array']['dir'] = $dir[$node_language->direction];
+      }
+    }
+  }
+}
diff --git a/core/modules/locale/locale.test b/core/modules/locale/locale.test
index 3474d78..06a68c6 100644
--- a/core/modules/locale/locale.test
+++ b/core/modules/locale/locale.test
@@ -1956,6 +1956,89 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
 
     $this->drupalLogout();
   }
+
+  /**
+   * Test if a dir and lang tags exist in node's attributes, if node's
+   * language and direction are different from the interface language and
+   * direction.
+   */
+  function testContentTypeDirLang() {
+    // User to add and remove language.
+    $admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages'));
+    // User to create a node.
+    $web_user = $this->drupalCreateUser(array('create article content', 'edit own article content'));
+
+    // Login as admin.
+    $this->drupalLogin($admin_user);
+
+    // Install Arabic language.
+    $edit = array();
+    $edit['predefined_langcode'] = 'ar';
+    $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
+
+    // Install Spanish language.
+    $edit = array();
+    $edit['predefined_langcode'] = 'es';
+    $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
+
+    // Set "Article" content type to use multilingual support.
+    $this->drupalGet('admin/structure/types/manage/article');
+    $edit = array(
+      'language_content_type' => 1,
+    );
+    $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
+    $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), t('Article content type has been updated.'));
+    $this->drupalLogout();
+
+    // Login as web user to add new article.
+    $this->drupalLogin($web_user);
+
+    // Create three nodes: English, Arabic and Spanish.
+    $node_en = $this->createNodeArticle('en');
+    $node_ar = $this->createNodeArticle('ar');
+    $node_es = $this->createNodeArticle('es');
+
+    $this->drupalGet('node');
+
+    // Check if English node does not have lang tag.
+    $pattern = '|id="node-' . $node_en->nid . '"[^<>]*lang="en"|';
+    $this->assertNoPattern($pattern, t('The lang tag has not been assigned to the English node.'));
+
+    // Check if English node does not have dir tag.
+    $pattern = '|id="node-' . $node_en->nid . '"[^<>]*dir="ltr"|';
+    $this->assertNoPattern($pattern, t('The dir tag has not been assigned to the English node.'));
+
+    // Check if Arabic node has lang="ar" & dir="rtl" tags.
+    $pattern = '|id="node-' . $node_ar->nid . '"[^<>]*lang="ar" dir="rtl"|';
+    $this->assertPattern($pattern, t('The lang and dir tags have been assigned correctly to the Arabic node.'));
+
+    // Check if Spanish node has lang="es" tag.
+    $pattern = '|id="node-' . $node_es->nid . '"[^<>]*lang="es"|';
+    $this->assertPattern($pattern, t('The lang tag has been assigned correctly to the Spanish node.'));
+
+    // Check if Spanish node does not have dir="ltr" tag.
+    $pattern = '|id="node-' . $node_es->nid . '"[^<>]*lang="es" dir="ltr"|';
+    $this->assertNoPattern($pattern, t('The dir tag has not been assigned to the Spanish node.'));
+
+    $this->drupalLogout();
+  }
+
+  /**
+   * Create node in a specific language.
+   */
+  private function createNodeArticle($langcode) {
+    $this->drupalGet('node/add/article');
+    $node_title = $this->randomName();
+    $node_body =  $this->randomName();
+    $edit = array(
+      'type' => 'article',
+      'title' => $node_title,
+      'body' => array($langcode => array(array('value' => $node_body))),
+      'language' => $langcode,
+      'promote' => 1,
+    );
+    return $this->drupalCreateNode($edit);
+  }
 }
 
 /**
