I wanted to use this great module on a multilingual website using i18n_taxonomy. I discovered that when using this module as a filter on a view, taxonomy terms were not displayed in the same language of the page.
I did a couple of changes, and now it works. This is what I have made:
1. I have added a 'langcode' setting in the view handler filter:
global $language_content;
$element_settings = array(
'create_new_terms' => FALSE,
'create_new_levels' => FALSE,
'required' => FALSE,
'langcode' => $language_content->language,
);
2. In shs.module, function shs_term_get_children, I have replaced
$tree = taxonomy_get_tree($vid, $parent, 1);
with the following:
$tree = i18n_taxonomy_get_tree($vid, $settings['langcode'], $parent, 1);
I'm not sure if this is the best way of solving the problem (any feedback will be appreciated), but now it works fine, picking up the terms in the same language of the page.
It would be great if shs could support i18n_taxonomy terms natively.
Thanks!
Comments
Comment #1
stborchertHey.
We are already working on a solution for i18n integration (see #1950654: Support multilingual taxonomy) so it would be great if you could join the conversation over there.
(btw.: thanks for hinting the exposed filter. I would have forgotten them.)
Comment #2
pinueve commentedHi, I can't make it work SHS on i18n_taxonomy in node add/edit form in a multilingual website, is there a way to implement it.?
Thank you @stBorchert, dev version solve it, regards. (see next comment)
Comment #3
stborchert@pinueve: this has been fixed in the latest development version. See #1950654: Support multilingual taxonomy for more details.