Hi,
I have a site with 3 languages (EN, FR, NL) and various instances of a taxonomy that needed to be translated (as a block and in an exposed form).
I went with the 'localised vocabulary' option where the locale module would take care of localization.
Default language works fine but when I try to select a different language, the translation nor the default language termsdon't pop up. In the exposed form, this even causes an 'illegal choice detected' error. Other people are also banging their heads on this one (#346028: Translate taxonomy term names in Views)
I started digging and I noticed that when I used taxonomy_get_tree, it would return NULL when I switched from default to another language. The culprit seems to be the i18ntaxonomy_db_rewrite_sql function. Regardless of the translation mode you put your vocabulary in (under 'edit vocabulary'), it just adds an extra where clause to query in taxonomy_get_tree(). The net result is a query that doesn't deliver any results.
If you want to recreate an instance that shows a symptom of the problem:
1. enable i18n and taxonomy translation modules
2. enable a few languages (leave english as default)
3. put the language switcher block somewhere
4. create a category and make sure the translation option is 'localized terms'. Add a content type to the vocabulary. Translate the terms in the vocabulary with the language search interface (just like any other localized string)
5. Add some content to your site
6. Create a page view that shows your content. Create an exposed filter 'term (with depth)' and select the vocabulary we just created
7. Go to the page view: default language will work fine, switch to a different language: the exposed filter select list will be empty and an 'illegal choice detected' error will be thrown.
Alternatively: create a block module and output the result of taxonomy_get_tree() for your vocabulary. You should get NULL if you switch to some other language but the default language.
How to solve this:
Go to i18ntaxonomy.module, line 304. Comment this piece code out:
$result['where'] = i18n_db_rewrite_where($primary_table, 'taxonomy', $mode);
lo and behold: the taxonomy gets translated just like it should.
My guess would be that a patch for i18n_selection_mode would solve a quite a fiew of unresolved issues.
Comments
Comment #1
jose reyero commented#1303518: Clean up the issue tracker. Close old issues without follow up.