language=='en'){$lang='en';}else{$lang='el';}
if ($view->name == 'myviewname') {
$query->where[] = array(
'conditions' => array(array(
'field' => 'taxonomy_term_data.language',
'value' => array("$lang"),
'operator' => 'in',
)),
'args' => array(),
'type' => 'AND',
);
}
}
?>
The "if" language should be changed according with the "languages" you have enabled.Have you ever searched “Views” for a way to filter the taxonomy terms by language (as done for nodes), but you didn't find a way to do it?
Does “Views” also support that filter in taxonomies or only in nodes? How can I filter the taxonomy terms by language?
Well guess what! “Views” does not do this by default, but it should not be difficult for a drupal web developer. You can add a mini module for this exact purpose. Before you apply the code below you should check the following:
First: Have you enabled the (i18n) Internationalization Module? (http://drupal.org/project/i18n) and the Taxonomy Translation Submodule?
Second: Have you enabled the “Translate. Different terms will be allowed for each language and they can be translated.” in the vocabulary page? If you have a vocabulary named: categories you should find this option at the url below: admin/structure/taxonomy/categories/edit
Third: Translate the taxonomy terms, one for each language e.g house (english) will be translated into κατοικία (greek).
And that’s it. You are ready.
views
custom module
taxonomy
i18n
translation