I am configuring views to display cck nodes, and some of my filters are exposed.
One of such filters is "Taxonomy: Term ID".
My taxonomy terms in this vocabulary are common for all languages, and their names are already translated. When I am viewing or editing nodes, names of all taxonomy terms are displayed in the current language as they should be.

The problem is: In dropdown lists of exposed filters, taxonomy terms are always shown in the default language, regardless of the current language.
(For exposed filters based on cck fields, dropdown lists of labels for allowed values are displayed in the current language as they should be: the problem arises only for taxonomy-based filters. I guess it's possible to solve the problem by converting taxonomy terms into a cck field with Content Taxonomy, but I'm not sure if it would be the best solution.)

Comments

david lesieur’s picture

What translation mode did you use for your terms, Localize terms or Per language terms?

GN’s picture

"Localize terms. Terms are common for all languages but their name and description may be localized."

jose reyero’s picture

Component: Module i18nviews » Compatibility
Status: Active » Fixed

Views integration is still WIP

See http://drupal.org/node/313262

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Alice Heaton’s picture

I know this has been closed, but in case you are still looking for this, there is patch there : http://drupal.org/node/337348#comment-1525474

GN’s picture

Version: 6.x-1.0-beta3 » 6.x-1.7
Status: Closed (fixed) » Active

The problem is still unsolved for the current 6.x-1.7 version of i18n.
Taxonomy terms (common for all languages, localizable) shown in dropdown lists of exposed filters are not translated: original names are displayed instead of the translated names.

See also an i18nviews issue "Terms in exposed filter not translated" (http://drupal.org/node/929368) that seems to describe the same kind of problem.

The problem seems to exist also for per-language terms - see "Translation of taxonomy terms in exposed filters" (http://drupal.org/node/959704).

GN’s picture

As a workaround, it's possible to add a Content Taxonomy field and expose it in your filter instead of the taxonomy terms. In this case, term names in dropdown lists are properly translated.

However, it does not work when you need to group items via Argument Summary (see Content Taxonomy issue #974262: Argument Summary View: term id's displayed instead of term names).

facal’s picture

Version: 6.x-1.7 » 7.x-1.x-dev

I am still experiencing this issue with 7.x-1.x-dev version of 02 December 2011. Am i missing something or this is still unresolved?

jose reyero’s picture

Status: Active » Closed (won't fix)

There's another module for views integration: i18nviews.

idflood’s picture

Status: Closed (won't fix) » Active

Sorry to reopen this but I feel i18nviews isn't really helpful here. From the description, it will help for string translation like header and footer. I've only quickly tested i18nviews so I may be wrong.

edit: I've made a quick attempt at fixing this in i18n_vocabulary. It works with an exposed filter (select) on a specific site.

function i18n_taxonomy_form_alter(&$form, $form_state, $form_id) {
  switch ($form_id) {
    case 'views_exposed_form':
      global $language;
      foreach ($form as $key => $val) {
        if (isset($val['#type']) && $val['#type'] == "select" && isset($val['#options'])) {
          foreach ($val['#options'] as $key2 => $val2) {
            $term = taxonomy_term_load($key2);
            if (isset($term->tid)) {
              $form[$key]['#options'][$key2] = i18n_taxonomy_term_name($term, $language->language);
            }
          }
        }
      }
      break;
...
webflo’s picture

Status: Active » Closed (works as designed)

i18nviews adds translated handlers (fields, filter, contextual filter) for each taxonomy field. Here is an example:


$view = new view;
$view->name = 'view_295315';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'view-295315';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'view-295315';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Has taxonomy term (translated) */
$handler->display->display_options['filters']['tid_i18n']['id'] = 'tid_i18n';
$handler->display->display_options['filters']['tid_i18n']['table'] = 'taxonomy_index';
$handler->display->display_options['filters']['tid_i18n']['field'] = 'tid_i18n';
$handler->display->display_options['filters']['tid_i18n']['exposed'] = TRUE;
$handler->display->display_options['filters']['tid_i18n']['expose']['operator_id'] = 'tid_i18n_op';
$handler->display->display_options['filters']['tid_i18n']['expose']['label'] = 'Term';
$handler->display->display_options['filters']['tid_i18n']['expose']['operator'] = 'tid_i18n_op';
$handler->display->display_options['filters']['tid_i18n']['expose']['identifier'] = 'tid_i18n';
$handler->display->display_options['filters']['tid_i18n']['expose']['reduce'] = 0;
$handler->display->display_options['filters']['tid_i18n']['reduce_duplicates'] = 0;
$handler->display->display_options['filters']['tid_i18n']['type'] = 'select';
$handler->display->display_options['filters']['tid_i18n']['vocabulary'] = 'tags';
$handler->display->display_options['filters']['tid_i18n']['error_message'] = 1;

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'view-295315';

jasom’s picture

Any progress on this?

heyehren’s picture