2

So I've got a views page displaying a list of nodes from specific content type. This view has filter form exposed in a block.

Some of the filters in the form are vocabularies. I'm using the BEF module to display the terms from each vocabulary as checkboxes instead of the default select lists.

The terms are translated - I'm using i18ntaxonomy for that, the vocabularies have this option selected: Localize terms. Terms are common for all languages, but their name and description may be localized.

The problem is that when the site is displayed in other languages different than the default one, the terms in the form are not translated.

I guess the problem is not with BEF as when I disable the module the terms remain untranslated.

I'm looking for any advice on how to debug/solve this issue.

This is definitely not the correct way to do it, but as the project deadline is tomorrow I've got no other choice but to hack the views module source code:

--- a/htdocs/sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc
+++ b/htdocs/sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc
@@ -122,7 +122,7 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
           $result = db_query("SELECT td.* FROM {term_data} td INNER JOIN {vocabulary} v ON td.vid = v.vid ORDER BY v.weight, v.name, td.weight, td.name");
         }
         while ($term = db_fetch_object($result)) {
-          $options[$term->tid] = $term->name;
+          $options[$term->tid] = i18ntaxonomy_translate_term_name($term);
         }
       }

I don't think a patch for the views module will be accepted. Any suggestions how should I proceed with this?

1

Your best path would be to open an issue with Views after confirming that the terms don't translate correctly with BEF module disabled.

I found this issue related to translation in BEF's queue, but that looks to be slightly different or only part of your issue.

Unfortunately it can be difficult for contrib module maintainers to test their modules in multiple languages unless they happen to run their own multilingual site, so it is up to the community to make them aware of issues and help test patches.

You also might want to take a look at http://drupal.org/project/i18nviews

  • Hey, thanks for looking at this. As I've already wrote above, I have confirmed that the issue is not with BEF. Unfortunately the i18nviews module doesn't solve the problem neither. So yes, I'll be opening an issue, just have to decide in which queue, maybe the i18nviews is the appropriate place for that, but I think the views code has to be changed. I'll have to look more at how things are handled in views-3 first. – mmartinov Apr 6 '11 at 8:40
1

According to Martin, it's not an issue with BEF. I was struggling with this and after installing http://drupal.org/project/i18nviews I saw an option in my view that said: Profile: Country (field_academy_country) (translated) --> In your case would be Content Type: Field title (field_name) (translated). This provides me an exposed filter with translated terms. Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.