How to

HOW TO: Drupal 6 Multilingual with Views and i18n

I'm working right now on building a multilingual website. I've done that already, it was an preaty easy job. But now, I'm also using the "Views" module (and others). While the "Views" module is a great tool that makes your life easier, it can't do one major thing: work with i18n. After lots of reading, I came across this, this and this issues. Everybody complains about the lack of compatibility between these two great modules.

I saw that there are two modules ("Insert view" and "Viewfield") trying to solve this major issue, but none of these provide an elegant solution. The first one is actually an input filter and you have to manualy write something like this: "[view:name of view=name of display=arg1,arg2,arg3]" into the node's body. That's not a very user-friendly approach. The second one is an CCK field module. When you create a new node, you can select from a dropdown list, the view you want to use. The problem is that this module is still in development phase, so there's no stable version for Drupal 6.x.

Since the "CTools" is a new module, I guess there aren't too many people using it so this could be the lack of online help provided for this issue. Now, all you have to do is to download and enable these modules: CTools and Panels (and also Views and i18n).

Follow these steps:

  1. create the view you need
  2. after you set up the fielters you need, you add one more: the "Node translation: Language" filter (screenshot)
  3. set the "Operator" to "Is one of" and the "Language" to "Current user's language" (in this filter settings). You now have a view that show only the nodes for the selected language (screenshot)
  4. create a "Panel" node
  5. in the "Panel content" tab, click the "Add content" link (screenshot)
  6. now select the view you want (screenshot)
  7. translate this node into any language you need, repeating the steps 5 and 6 for this new node and you're done.

Now, the language switcher block work just fine and you have a multilingual website.

Syndicate content