Index: modules/comment/comment.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v retrieving revision 1.35 diff -u -p -r1.35 comment.admin.inc --- modules/comment/comment.admin.inc 16 Oct 2009 20:40:05 -0000 1.35 +++ modules/comment/comment.admin.inc 2 Nov 2009 14:01:21 -0000 @@ -63,8 +63,14 @@ 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 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'); @@ -72,7 +78,7 @@ function comment_admin_overview($form, & $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( @@ -90,8 +97,11 @@ function comment_admin_overview($form, & 'author' => theme('username', array('account' => $comment)), 'posted_in' => l($comment->node_title, 'node/' . $comment->nid), 'changed' => format_date($comment->changed, 'short'), - 'operations' => l(t('edit'), 'comment/' . $comment->cid .'/edit', array('query' => $destination)), ); + if ($multilingual) { + $options[$comment->cid]['language'] = empty($comment->language) ? t('Language neutral') : t($languages[$comment->language]->name); + } + $options[$comment->cid]['operations'] = l(t('edit'), 'comment/' . $comment->cid .'/edit', array('query' => $destination)); } $form['comments'] = array( Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.798 diff -u -p -r1.798 comment.module --- modules/comment/comment.module 2 Nov 2009 01:00:42 -0000 1.798 +++ modules/comment/comment.module 2 Nov 2009 14:04:08 -0000 @@ -287,6 +287,10 @@ function comment_permission() { 'title' => t('Post comments without approval'), 'description' => t('Add comments to content (no approval required).'), ), + 'change comments language' => array( + 'title' => t('Change comments language'), + 'description' => t('Change comments language on post and edit.'), + ) ); } @@ -1878,6 +1882,22 @@ function comment_form($form, &$form_stat '#type' => 'value', '#value' => 'comment_node_' . $node->type, ); + // Add the language selector if there are at least two languages enabled, the + // content type has multilingual support and user has 'change comments + // language' permission. + if (drupal_multilingual() && variable_get('language_content_type_' . $node->type, FALSE)) { + $options = array('' => t('Language neutral')); + foreach (language_list() as $language) { + $options[$language->language] = t($language->name); + } + $form['language'] = array( + '#type' => 'select', + '#title' => t('Language'), + '#default_value' => (isset($comment->language) ? $comment->language : ''), + '#options' => $options, + '#access' => user_access('change comments language') + ); + } // Only show the save button if comment previews are optional or if we are // already previewing the submission. However, if there are form errors,