I have a vocabulary that is set to 'Localize. Terms are common for all languages, but their name and description may be localized.'. The term title is in English that i translated to different languages. When i create a node of a content type that uses this vocabulary the term are translated in the languages of the current user.
But when i create a view with an exposed filter for this vocabulary the term titles are always in English in stead of the users language

I'm not sure if this is even something i18views provides, but if it is, it's not working for me.

I updated i18nviews to the latest dev version.


marco_cruz’s picture

Same problem in 7.x-3.1....

indigoxela’s picture

Same problem here with i18nviews version = "7.x-3.x-dev". Term names in exposed filters are not translated.
My setup is very similar to dazz' description.

After struggling with this for over a day I found a workaround with some inline javascript.
I copied views-view.tpl.php over to my theme directory (as views-view--[myviewsname]-page.tpl.php) and added following code at the bottom:

global $language;
$langcode = $language->language;

if ($langcode != 'de' && function_exists('i18n_taxonomy_term_name')) {
  print '<script type="text/javascript">';
  print "document.getElementById('edit-tid').options.length=0;";
  $terms = taxonomy_get_tree(2,0,1);

  foreach($terms as $key => $term){
    $transterm = i18n_taxonomy_term_name($term, $langcode);
    print 'document.getElementById("edit-tid").options['.$key.']=new Option("'.$transterm.'", "'.$term->tid.'", false, false);';
  print '</script>';

German (de) is the default language - I don't need this workaround for the default language,
edit-tid is the ID of the widget select box,
2 is the vid of the taxonomy vocab used in my case (first option of taxonomy_get_tree).

All options in the exposed filter widget's select box get reset and overwritten with javascript.

Although this trick helps me out for now (and maybe one or two other people who read this), I would appreciate a solution in i18nviews or i18n or views.

indigoxela’s picture

Finally I found the right preprocessor and was able to solve the problem in template.php:


/* views preprocessor for filter widget to get i18n translation of termname */
function MY_THEMENAME_preprocess_views_exposed_form(&$vars) {
  $myviewID = 'views-exposed-form-partner-overview-page';

  if ($vars['form']['#id'] == $myviewID && function_exists('i18n_taxonomy_term_name')) {

    global $language;
    $langcode = $language->language;

    foreach($vars['form']['tid']["#options"] as  $term_id => $value) {
      $term = taxonomy_term_load($term_id);
      $vars['form']['tid']["#options"][$term_id] = i18n_taxonomy_term_name($term, $langcode);
    $vars['widgets']['filter-tid']->widget = drupal_render($vars['form']['tid']);


Term names in views exposed filter widget appear in correct translation.

If you need this, replace $myviewID with your views exposed form ID.

lmeurs’s picture

In Views you can choose "Content: Has taxonomy term (translated)" as a filter, this probably solves you problem.

Can you confirm this and if so, can you close this issue?

Anonymous’s picture


I've tested this solution on a french/english(default) website and as said lmeurs you can use "Content: Has taxonomy term (translated)" as a filter, it works but not totally.

ONLY the terms will be translated (localized depending of the current language) but NOT the vocabulary title.
To achieve the translation of any title translations, titles of columns in your table of results for example go to:
Home » Administration » Configuration » Regional and language » Translate interface
and then search for each string that are not translated yet. Translate each of them.

The only annoying point here is that you will have to translate many times the same item (some times you were thinking you had already translated but views needs to have its own translation strings, etc...). Hope in the future it will be more simple. A real common dictionnary of strings translations would be much better.

dlnsk’s picture

Issue tags: +i18n, +title, +#taxonomy

I using this simple snippet for translate taxonomy term title in Views:

if ($term = taxonomy_term_load($argument)) {
  if (function_exists('i18n_taxonomy_term_name')) {
    global $language;
    $handler->validated_title = i18n_taxonomy_term_name($term, $language->language);
  return true;
return false;

You should place this snippet in View->Contextual filters->Content: Has taxonomy term ID (or with depth)
Check "Override title" and use %1 in field.
Check "Specify validation criteria" and choose "PHP Code" validator.
Past snippet in field "PHP validate code".

Pure’s picture

Sry, everything is fine!


jasom’s picture

#6 was usefull, tnx dlnsk


When you want to see translation taxonomy term title in exposed filter you must use not

Content: Category (field_category_article) field


Content: Category (field_category_article) (translated) field

intyms’s picture

Here is a changed code from #3:

function MYTHEME_NAME_preprocess_views_exposed_form(&$vars) {
  $myviewID = 'views-exposed-form-new-products-panel-pane-1';
	if ($vars['form']['#id'] == $myviewID && function_exists('i18n_taxonomy_term_name')) {
		global $language;
    $langcode = $language->language;
		if ($langcode <> "en") {
			foreach($vars['form']['field_product_category_tid']["#options"] as  $term_id => $value) {
				$term = taxonomy_term_load($term_id);
				if (is_numeric($term_id)) {
					$vars['form']['field_product_category_tid']["#options"][$term_id] = i18n_taxonomy_term_name($term, $langcode);
			$vars['widgets']['filter-field_product_category_tid']->widget = drupal_render($vars['form']['field_product_category_tid']);	

1) in my case, i replaced "tid" with "field_product_category_tid". I had to print the variable list to see that i don't have tid.
also i replaced ['filter-tid'] with ['filter-field_product_category_tid'].
2) english is the default website language. replace "en" with your default language.
3) In my case, the exposed filter looks like this:
The first item is not a term id. It's a string.
That's why, i added "if (is_numeric($term_id))"...
4) i don't use i18nviews

kopeboy’s picture

Priority: Normal » Major
Issue summary: View changes

Guys, there is no "(translated)" version of the field if the view display is a Search Index.

I am translating terms with Entity Translation: it works everywhere, even on Facets of the same Search index view, but if I use the field as an exposed filter instead, the term names are not translated.

webflo’s picture

Please use the default filter from views. This should translate all terms via entity_label because i18n_taxonomy provides a entity label callback. Please review/test #1910716: Exposed filters multiple and required options not handled correctly as well.

webflo’s picture

Issue tags: -#taxonomy +taxonomy
Dima DD’s picture

Just faced the same problem for overriden titles in contextual filters, solution given in #6 works fine for me, thanx dlnsk!