I use the standard taxonomy term view to list all nodes associated to a taxonomy term. Taxonomy is i18n localized (same terms for all language but terms are translated)

At the top of the view the current taxonomy term is displayed as the title. But the title is not translated. It does not come from the taxonomy config since the term is translated in other pages.

The title is generated by the "Override title" option in the "Has taxonomy term ID (with depth)" contextual filter where it takes the option %1 from the URL (see capture attached)

How can I translate the taxonomy term so that the title is displayed in the appropriate language?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webflo’s picture

Status: Active » Fixed
FileSize
284.57 KB

You need to add an validation criteria. Look at the attached screenshot or import the attached example view.


$view = new view;
$view->name = 'issue_1541924';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'issue-1541924';
$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'] = 'issue-1541924';
$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';
/* Contextual filter: Content: Has taxonomy term ID */
$handler->display->display_options['arguments']['tid']['id'] = 'tid';
$handler->display->display_options['arguments']['tid']['table'] = 'taxonomy_index';
$handler->display->display_options['arguments']['tid']['field'] = 'tid';
$handler->display->display_options['arguments']['tid']['title_enable'] = 1;
$handler->display->display_options['arguments']['tid']['title'] = '%1';
$handler->display->display_options['arguments']['tid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['tid']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['tid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['tid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['tid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['tid']['specify_validation'] = 1;
$handler->display->display_options['arguments']['tid']['validate']['type'] = 'i18n_taxonomy_term';
$handler->display->display_options['arguments']['tid']['validate_options']['type'] = 'i18n_tid';
$handler->display->display_options['arguments']['tid']['validate_options']['transform'] = 0;
$handler->display->display_options['arguments']['tid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['tid']['add_table'] = 0;
$handler->display->display_options['arguments']['tid']['require_value'] = 0;
$handler->display->display_options['arguments']['tid']['reduce_duplicates'] = 0;
$handler->display->display_options['arguments']['tid']['set_breadcrumb'] = 0;
/* 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'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;

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

Status: Fixed » Closed (fixed)

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

lmeurs’s picture

I had the same problem with the term's title not being localized on a term page.

In "Views > Advanced > Contextual filters > Content: Has taxonomy term ID (with depth)" I can select the validator "Taxonomy term (i18n)", but the filter value type select does not offer "Term ID" (see attached screenshot). When I change the validator to "Taxonomy term", the filter value type "Term ID" appears.

This happened with both my own view as with the exported view from #1. I'm using i18nviews 7.x-3.x-dev and Views 7.x-3.3.

Does anyone have a clue why the "Term ID" options does not appear for validator "Taxonomy term (i18n)"? Thanks in advance!

JurgenR’s picture

Working fine.

marcoka’s picture

works just great!

nachenko’s picture

Not working for me, but what its really pissing me off is that it works as expected in the preview box of the View UI, but not in the real view. I tried using the default theme, in case my theme has a bug, but it also happens there. It translates neither the page.tpl title nor the window title.

Anonymous’s picture

Status: Active » Closed (fixed)

[solved]

Anonymous’s picture

Status: Closed (fixed) » Active
Anonymous’s picture

knalstaaf’s picture

Issue summary: View changes

#3 works fine, thank you.