Index: i18ntaxonomy.module
===================================================================
--- i18ntaxonomy.module	(revision 1650)
+++ i18ntaxonomy.module	(working copy)
@@ -645,3 +645,14 @@ function i18ntaxonomy_vocabulary($vid = 
     return $options;
   }
 }
+
+/**
+ * Implementation of hook_views_api
+ */
+function i18ntaxonomy_views_api() {
+  return array(
+    'api' => '2.0',
+    'path' => drupal_get_path('module', 'i18ntaxonomy'),
+  );
+}
+
Index: i18ntaxonomy.views.inc
===================================================================
--- i18ntaxonomy.views.inc	(revision 0)
+++ i18ntaxonomy.views.inc	(revision 0)
@@ -0,0 +1,28 @@
+<?php
+
+// $Id: i18ntaxonomy.views.inc,v 1.0.0 2009/03/18 15:35:00 dagmar Exp $
+
+/**
+ * Implementation of hook_views_data_alter().
+ */
+function i18ntaxonomy_views_data_alter(&$data) {
+  $data['term_node']['tid']['filter']['handler'] = 'i18ntaxonomy_handler_filter_term_node_tid';
+
+  $data['term_data']['tid']['filter']['handler'] = 'i18ntaxonomy_handler_filter_term_node_tid';
+}
+
+/**
+ * Implementation of hook_views_handlers().
+ */
+function i18ntaxonomy_views_handlers() {
+  return array(
+    'info' => array(
+      'path' => drupal_get_path('module', 'i18ntaxonomy') . '/includes',
+    ),
+    'handlers' => array(
+      'i18ntaxonomy_handler_filter_term_node_tid' => array(
+        'parent' => 'views_handler_filter_term_node_tid',
+      ),
+    ),
+  );
+}
Index: includes/i18ntaxonomy_handler_filter_term_node_tid.inc
===================================================================
--- includes/i18ntaxonomy_handler_filter_term_node_tid.inc	(revision 0)
+++ includes/i18ntaxonomy_handler_filter_term_node_tid.inc	(revision 0)
@@ -0,0 +1,76 @@
+<?php
+// $Id: i18ntaxonomy_handler_filter_term_node_tid.inc,v 1.6 2009/03/17 13:18 dagmar Exp $
+
+class i18ntaxonomy_handler_filter_term_node_tid extends views_handler_filter_term_node_tid {
+  function value_form(&$form, &$form_state) {
+    parent::value_form($form, $form_state);    
+
+    $this->_filter_term_language($form, $form_state);
+    $this->_localize_terms($form, $form_state);
+  }
+  
+  function expose_options() {
+    parent::expose_options();
+    $this->options['expose']['i18ntaxonomy_terms'] = FALSE;
+  }
+
+  function expose_form_right(&$form, &$form_state) {
+    parent::expose_form_right($form, $form_state);
+    $vocabulary = taxonomy_vocabulary_load($this->options['vid']);
+    if (i18ntaxonomy_vocabulary($vocabulary->vid) == I18N_TAXONOMY_TRANSLATE) {
+      $form['expose']['i18ntaxonomy_terms'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Limit list to terms with the same language that actual page language'),
+        '#description' => t('If checked, the only items presented to the user will be the ones whit the same page language.'),
+        '#default_value' => !empty($this->options['expose']['i18ntaxonomy_terms']), 
+      );
+    }
+  }
+
+  /*
+   * If enabled, only include terms in the current language.
+   */
+  function _filter_term_language(&$form, &$form_state) {
+    $vocabulary = taxonomy_vocabulary_load($this->options['vid']);
+    if (!empty($this->options['expose']['i18ntaxonomy_terms'])) {
+      if (empty($this->options['hierarchy'])) {
+        global $language;
+        $options = array();
+        $result = db_query("SELECT * FROM {term_data} WHERE vid = %d AND language = '%s' ORDER BY weight, name", $vocabulary->vid, $language->language);
+        while ($term = db_fetch_object($result)) {
+          $options[$term->tid] = $term->name;
+        }
+
+        $form['value'] = array(
+          '#type' => 'select',
+          '#title' => t('Select terms from vocabulary @voc', array('@voc' => $vocabulary->name)),
+          '#multiple' => TRUE,
+          '#options' => $options,
+          '#size' => min(9, count($options)),
+          '#default_value' => $default_value,
+        );
+      }
+    }
+  }
+
+  /*
+   * Localize the terms
+   */
+  function _localize_terms(&$form, &$form_state) {
+    $tree = taxonomy_get_tree($this->options['vid']);
+    $treeid = array();
+    foreach ($tree as $term) {
+      $treeid[$term->tid] = $term;
+    }
+
+    foreach ($form['value']['#options'] as $index => $opt) {
+      foreach ($opt->option as $opt_key => $opt_value) {
+        if (!isset($treeid[$opt_key])) continue;
+
+        $depth = str_repeat('-', $treeid[$opt_key]->depth);
+        $localized = tt("taxonomy:term:$opt_key:name", $opt_value);
+        $form['value']['#options'][$index]->option[$opt_key] = $depth . $localized;
+      }
+    }
+  }
+}
