Author image
Senior Mind

Multilingual views in Drupal when using i18n module

Building multilingual sites in Drupal using the i18n module always throws up a few fun problems to be solved. One of the most awkward being views.

The i18n views integration module does an excellent job of allowing you to return only nodes matching a particular language, but it doesn't help when it comes to translating the view itself - and more importantly allowing a view to site nicely into multiple positions in the menu (one per language).

The solution is to use the excellent insert view module (http://drupal.org/project/insert_view - you can use this guide to get the module and filter working - http://drupal.org/node/85769) to embed a view directly into a node. We will then translate the node (getting a new menu item for each language as you would with a normal node). You can optionally specify a different view per language (to enable you to translate things like the empty text), or just use the same view accross all languages.

And thats all there is to it! Just to recap -

  1. Download the insert_view module http://drupal.org/project/insert_view
  2. Follow this guide to configure your filters
  3. Set up your view, and optionally a version of your view for each target language (if you have text within the view that requires translation)
  4. Create a new node and insert your view into it using the view filter tag [view:name of view]
  5. Translate this node into each target language, each translation can have its own menu entry
  6. Sit back and relax :)

Comments

Excellent, I searched all over for this

Way cool.
I was struggling with a dual language view, wondering how I was going to manage translating the Title and such. This approach makes it so much simpler. Elegant.
Funnily enough, I use the insert views module on this site already, but it did not occur to me to use it in this context. ...... D'oh!!

I'd like to note that in Drupal 6, one can obtain the same result using panel nodes instead of the insert_node module.

This is a great post!

good job, but why dont you post that on drupal.org, so everyone can participate.
but thx anyway

What a seviour !
Yes it would be great if you post it on the how to's section on drupal.org !

Thanks a lot

Does this work with views arguments ? Basically is there an easy way to make the node (page) you created pass on it's arguments to the embedded view ?

Thank you!

I have a problem with dynamic-current-language. View shows all content in all languages, not just current user language.

Hi! This looks promising. Any ideas on how to implement views menu tabs with this approach?? I've searched all over for a solution. No luck so far...

Comments on this article are now closed, if you want to give us feeback you can use our contact form instead.