Multilingual sites, translations and Selection Rules

I’m putting the finishing touches on my site and one of the things I have to do is translate a few stragglers on the UI. I use Bing Translator (see THIS for info about how to integrate this widget in Drupal 7) for translating externally generated content but since machine translation can be dicey, I try to translate as much as I can manually using Locale, Content Translation and other Drupal multilingual modules along with Selection Rules that look to the user’s profiled language. That way I can be sure the the UI itself is correct.

Image

The Translate Interface feature from Drupal makes it pretty easy to track down strings that have or need to be translated. But because of its modular nature, this isn’t consistent. For example, I have a content type called HTML Text that I user to insert, HTML, of course. This works like an object in OOP languages, the HTML (it can form a link, reference an image, just about anything) becomes a node and can be placed anywhere on your site that you need.

In this case I have an image and a link that point to a relative path on the site. The text for the link itself is in English and I need it to be in Spanish as well. But since this is one of the cases where you can’t use the Translate Interface UI (because it is a custom content type) I have to acheive this by creating a separate node with the same text in Spanish. Two nodes, one location. In this case the placement is done via a minipanel that will be nested inside a larger panel. So, in the minipanel, I “stack” the two minipanels as seen in the SS. You can see that I use a Selector Rule to choose this Panel if the site langauge is Spanish. You don’t see it but the top panel has the same rule for English. The language is set on the user object of the account. Since these are separate nodes, they have separate node IDs within the CSS. So be

Imageaware of how you implement CSS if the two nodes don’t style consistently.

Drupal has many quirks but I haven’t found one yet that can’t be worked around with a little creativity. This is certainly one such instance.

Minipanels, Panels and the flexible, Responsive, layout that I have wanted

Well, I don’t really know why I didn’t make this work better quite a while ago. If you need flexibility in your page layouts and you use a lot of Views, then I believe that this is the way to go. Use Panels for the overall layout and then plug in smaller bits of content within the Panel locations using Minipanels. I tried using them before and I think that I simply made a couple of mistakes in implementing them. But now that I know a little more than I did before, I have used them successfully and their implementation is going to be a real Godsend to me.

learn drupal - minipanels

 

Here is a little image of what you can do. The layout here is a standard AT_Core layout that I have subthemed. I used Minipanels to add the smaller black boxes in the layout. Now I can have two elements at the very top of the page without having to use so much CSS that I run into other problems later, especially when I view the site on a mobile device. And the page is all Panels so there is a lot of consistency. The only issue is that I have to edit the Minipanel separately from the rest of the panel page.