I have site with a taxonomy that is set to localized mode. Translation seems to work well enough in core, except that I cannot get those fields to display properly in Views.
I know that the i18nviews is supposed to solve this problem, but it does not. What I was hoping to do is fetch all the translated data on a term and display the language appropriate content via a views preprocess or tpl override to circumvent this problem.
However, I've tried the i18n_taxonomy_term_name
function (which returns an empty string) and the i18n_taxonomy_term_get_translation
function (returns the term id).
I'm wondering if there are any functions that I'm overlooking to get translated data from the term. Any insights would be greatly appreciated at this point. I have only found one similar issue (#1188862: How to print translated taxonomy term?) but it was not helpful.
Thanks,
Rene
Comments
Comment #1
Jose Reyero CreditAttribution: Jose Reyero commentedSee i18n_taxonomy_translate_terms()
Comment #3
hatuhay CreditAttribution: hatuhay commentedThis function is what i18n uses to generate tokens i18n_taxonomy_term_name($term, $language);
Comment #4
mohammadjolani CreditAttribution: mohammadjolani commenteduser this
Comment #5
liquidcms CreditAttribution: liquidcms commentedbeen struggling with this all night although i am sure i have done this numerous times before.
none of the functions above work.
i have a vocab set for localized terms: http://screencast.com/t/JZ0QUFMuQk0Z
and i have some terms which are translated: http://screencast.com/t/jZKPGkzQ
but there is no function i can see which will give me the translated term name:
i18n_taxonomy_localize_terms(taxonomy_term_load($tid)); => gives term only in EN (actually in current lang of the site)
i18n_taxonomy_get_tree($vid, $langcode); => gives nothing
i18n_taxonomy_term_name($term, $langcode)); => gives name only in EN
is it possible that Entity Translation is messing this up?
Comment #6
liquidcms CreditAttribution: liquidcms commentedhmm.. testing again and now this works:
i18n_taxonomy_term_name($term, 'ar');
Comment #7
skyredwang#4 works.