Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.789
diff -u -p -r1.789 comment.module
--- modules/comment/comment.module	16 Oct 2009 03:40:40 -0000	1.789
+++ modules/comment/comment.module	16 Oct 2009 04:15:53 -0000
@@ -705,6 +705,13 @@ function comment_get_thread($node, $mode
     ->condition('c.nid', $node->nid)
     ->addTag('node_access');
 
+  // Check if filters allowed for this node type.
+  $filters_allowed = variable_get('comment_filters_' . $node->type, FALSE);
+  if (!empty($filters_allowed)) {
+    $query->addTag('comment_filter');
+    $count_query->addTag('comment_filter');
+  }
+
   if (!user_access('administer comments')) {
     $query->condition('c.status', COMMENT_PUBLISHED);
     $count_query->condition('c.status', COMMENT_PUBLISHED);
@@ -1014,6 +1021,12 @@ function comment_form_node_type_form_alt
       '#title' => t('Require preview'),
       '#default_value' => variable_get('comment_preview_' . $form['#node_type']->type, COMMENT_PREVIEW_OPTIONAL),
     );
+    // Allow hook_query_comment_filter_alter to filter comments.
+    $form['comment']['comment_filters'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Allow comment filters'),
+      '#default_value' => variable_get('comment_filters_' . $form['#node_type']->type, FALSE),
+    );
   }
 }
 
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.264
diff -u -p -r1.264 locale.module
--- modules/locale/locale.module	16 Oct 2009 02:04:42 -0000	1.264
+++ modules/locale/locale.module	16 Oct 2009 04:15:53 -0000
@@ -468,7 +468,7 @@ function locale_theme() {
  */
 function locale_field_attach_view_alter(&$output, $context) {
   // In locale_field_fallback_view() we might call field_attach_view(). The
-  // static variable avoids unnecessary recursion. 
+  // static variable avoids unnecessary recursion.
   static $recursion;
 
   // Do not apply fallback rules if disabled or if Locale is not registered as a
@@ -1067,3 +1067,12 @@ function locale_date_format_reset_form_s
   $form_state['redirect'] = 'admin/config/regional/date-time/locale';
 }
 
+/**
+ * Implement hook_query_TAG_alter().
+ *
+ * Adds a filter by language for comments.
+ */
+function locale_query_comment_filter_alter(QueryAlterableInterface $query) {
+  global $language;
+  $query->where("language = :name", array(':name' => $language->language));
+}
