Index: modules/comment/comment.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v
retrieving revision 1.36
diff -u -p -r1.36 comment.admin.inc
--- modules/comment/comment.admin.inc	3 Nov 2009 05:27:18 -0000	1.36
+++ modules/comment/comment.admin.inc	7 Nov 2009 11:57:31 -0000
@@ -63,16 +63,22 @@ function comment_admin_overview($form, &
     'author' => array('data' => t('Author'), 'field' => 'name'),
     'posted_in' => array('data' => t('Posted in'), 'field' => 'node_title'),
     'changed' => array('data' => t('Updated'), 'field' => 'changed', 'sort' => 'desc'),
-    'operations' => array('data' => t('Operations')),
   );
 
+  // Enable the language column if there are at least two languages enabled.
+  $multilingual = drupal_multilingual();
+  if ($multilingual) {
+    $header['language'] = array('data' => t('Language'), 'field' => 'c.language');
+  }
+  $header['operations'] = array('data' => t('Operations'));
+
   $query = db_select('comment', 'c')->extend('PagerDefault')->extend('TableSort');
   $query->join('users', 'u', 'u.uid = c.uid');
   $query->join('node', 'n', 'n.nid = c.nid');
   $query->addField('u', 'name', 'registered_name');
   $query->addField('n', 'title', 'node_title');
   $result = $query
-    ->fields('c', array('subject', 'nid', 'cid', 'comment', 'changed', 'status', 'name', 'homepage'))
+    ->fields('c', array('subject', 'nid', 'cid', 'comment', 'changed', 'status', 'name', 'homepage', 'language'))
     ->fields('u', array('uid'))
     ->condition('c.status', $status)
     ->limit(50)
@@ -83,6 +89,7 @@ function comment_admin_overview($form, &
   // Build a table listing the appropriate comments.
   $options = array();
   $destination = drupal_get_destination();
+  $languages = language_list();
 
   foreach ($result as $comment) {
     $options[$comment->cid] = array(
@@ -103,13 +110,16 @@ function comment_admin_overview($form, &
         ),
       ),
       'changed' => format_date($comment->changed, 'short'),
-      'operations' => array(
-        'data' => array(
-          '#type' => 'link',
-          '#title' => t('edit'),
-          '#href' => 'comment/' . $comment->cid . '/edit',
-          '#options' => array('query' => $destination),
-        ),
+    );
+    if ($multilingual) {
+       $options[$comment->cid]['language'] = empty($comment->language) ? t('Language neutral') : t($languages[$comment->language]->name);
+    }
+    $options[$comment->cid]['operations'] = array(
+      'data' => array(
+        '#type' => 'link',
+        '#title' => t('edit'),
+        '#href' => 'comment/' . $comment->cid . '/edit',
+        '#options' => array('query' => $destination),
       ),
     );
   }
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.801
diff -u -p -r1.801 comment.module
--- modules/comment/comment.module	6 Nov 2009 03:59:06 -0000	1.801
+++ modules/comment/comment.module	7 Nov 2009 11:57:31 -0000
@@ -1652,6 +1652,7 @@ function comment_form($form, &$form_stat
 
   $op = isset($_POST['op']) ? $_POST['op'] : '';
   $node = node_load($comment->nid);
+  $form['#node'] = $node;
 
   if (!$user->uid && variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
     $form['#attached']['library'][] = array('system', 'cookie');
Index: modules/comment/comment.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v
retrieving revision 1.52
diff -u -p -r1.52 comment.test
--- modules/comment/comment.test	20 Oct 2009 17:33:42 -0000	1.52
+++ modules/comment/comment.test	7 Nov 2009 13:33:31 -0000
@@ -7,7 +7,8 @@ class CommentHelperCase extends DrupalWe
   protected $node;
 
   function setUp() {
-    parent::setUp('comment', 'search');
+    $args = array_merge(func_get_args(), array('comment', 'search'));
+    call_user_func_array(array('parent', 'setUp'), $args);
     // Create users and test node.
     $this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer blocks'));
     $this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content'));
@@ -914,3 +915,40 @@ class CommentRdfaTestCase extends Commen
     $this->assertEqual((string)$comment_author[0], $this->web_user->name);
   }
 }
+
+/**
+ * Functional tests for comments language administration.
+ */
+class CommentLanguageAdministrationTest extends CommentHelperCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Comment language administration',
+      'description' => 'Test the language administration for comments.',
+      'group' => 'Comment',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('locale');
+  }
+
+  function testLanguageAdministration() {
+    $this->admin_user = $this->drupalCreateUser(array('administer comments', 'access administration pages', 'administer languages', 'create article content'));
+    $this->drupalLogin($this->admin_user);
+    // Test that the language column is not present with only one language
+    // enabled.
+    $this->drupalGet('admin/content/comment');
+    $this->assertNoText(t('Language'), t('The language column is not present.'));
+    // Add Italian language.
+    $this->drupalGet('admin/config/regional/language/add');
+    $edit = array(
+      'langcode' => 'it',
+    );
+    $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
+    $this->assertText('it', t('Language added successfully.'));
+    // Test that the language column is present with more than one language
+    // enabled.
+    $this->drupalGet('admin/content/comment');
+    $this->assertText(t('Language'), t('The language column is present.'));
+  }
+}
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.267
diff -u -p -r1.267 locale.module
--- modules/locale/locale.module	24 Oct 2009 05:13:44 -0000	1.267
+++ modules/locale/locale.module	7 Nov 2009 12:04:57 -0000
@@ -307,6 +307,10 @@ function locale_permission() {
       'title' => t('Translate the interface'),
       'description' => t('Translate the text of the website interface.'),
     ),
+    'change comments language' => array(
+      'title' => t('Change comments language'),
+      'description' => t('Change comments language on post and edit.'),
+    )
   );
 }
 
@@ -1105,3 +1109,20 @@ function locale_url_outbound_alter(&$pat
     }
   }
 }
+
+/**
+ * Implement hook_form_FORM_ID_alter().
+ */
+function locale_form_comment_form_alter(&$form, &$form_state, $form_id) {
+  // Add the language selector if the content type has multilingual support and
+  // the user has the 'change comments language'.
+  if (locale_multilingual_node_type($form['#node']->type)) {
+    $form['language'] = array(
+      '#type' => 'select',
+      '#title' => t('Language'),
+      '#default_value' => (isset($form['language']['#value']) ? $form['language']['#value'] : ''),
+      '#options' => array('' => t('Language neutral')) + locale_language_list('name'),
+      '#access' => user_access('change comments language')
+    );
+  }
+}
Index: modules/locale/locale.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.test,v
retrieving revision 1.50
diff -u -p -r1.50 locale.test
--- modules/locale/locale.test	2 Nov 2009 05:57:05 -0000	1.50
+++ modules/locale/locale.test	7 Nov 2009 13:33:27 -0000
@@ -17,6 +17,7 @@
  *  - a functional test for configuring a different path alias per language;
  *  - a functional test for multilingual support by content type and on nodes.
  *  - a functional test for multilingual fields.
+ *  - a functional test for the comment language selector.
  */
 
 
@@ -1799,3 +1800,45 @@ class LocalizeDateFormatsFunctionalTest 
 }
 
 
+/**
+ * Functional tests for the comment language selector.
+ */
+class LocalizeCommentFunctionalTest extends CommentHelperCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Comment language selector',
+      'description' => 'Test the language selector for localized comments.',
+      'group' => 'Comment',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('locale');
+  }
+
+  function testLanguageAdministration() {
+    $this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'access administration pages', 'administer languages', 'create article content'));
+    $this->drupalLogin($this->admin_user);
+    // Add Italian language.
+    $this->drupalGet('admin/config/regional/language/add');
+    $edit = array(
+      'langcode' => 'it',
+    );
+    $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
+    $this->assertText('it', t('Language added successfully.'));
+    $edit = array(
+      'language_content_type' => 1,
+    );
+    $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
+    // Create an article.
+    $article = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
+    $this->drupalLogout();
+    $this->web_user = $this->drupalCreateUser(array('post comments without approval', 'change comments language'));
+    $this->drupalLogin($this->web_user);
+    // Post a comment to the previously created article.
+    $comment = $this->postComment($article, $this->randomName(8), $this->randomName(16));
+    $this->drupalGet('comment/' . $comment->id . '/edit');
+    // Test that the language selector is present.
+    $this->assertText(t('Language'), t('Language selector is present.'));
+  }
+}
