I have a front/login page that is available to anonymous users. I need to be able to deliver the page bilingually but I rely primarily on the Drupal account settings and language switcher to determine whether the site is presented in English or Spanish. So how do I present in Spanish to anonymous users when appropriate? Drupal also allows you to use the user’s browser settings as well to determine what language to display. And it also allows you to change the order of factors to determine what language to present in. After some testing and a lot of thought about the UX, I have settled on,
- Browser settings – Helps for Anonymous
- Session parameter – If a Spanish defined account want to use the language switcher to get English instead for that session
- Account settings – The catch-all
- Default site language
In my specific case, this will provide the most flexibility for my audience.
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.
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
aware 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.
I have the module installed, the content type created and I have links that are made from this type. And the site opens in the iframe but the translator settings are not following the iframe, which is what I need. I need to be able to allow my users an easy way to translate external content. I’ll figure it out. But that’s about all I am going to be doing today.
I have a bunch of external links that I need to be displayed in a way that they still are a part of the site. This way, the external sites can still be translated from the translation widget that I have installed on the site. I have downloaded this module – External Iframes – and will be testing it out to see how it goes.
I went with a module based solution because I don’t want to write the code myself for doing I frames. I don’t want to have to maintain that.
X modulesX multilingualX bilingualX englishX spanishX microsoft translatorX iframeX external content translation
I am so happy right now that I could almost cry. If it weren’t for the mainliners that live in the halfway house that we share I would. You just don’t cry in front of felons…
I have the multilingual stuff setup just the way that I want. And it works really seemlessly. I have a variant (actually I have three) on the main page of my site, DOCResource.org. You can go and check this out for yourself if you want.
Variants – in this order – order is important!
- Spanish users – the condition on this is whether the site language is spanish or not. this variant has a panel pane that displays the Misc item created by the Widget mod that holds the HTML & Jscript for the language switcher. The variable on this page is controlled by one of two elements; the user account or the choice from the language switcher dropdown. All Drupal translated items are in Spanish via Internationalization and the RSS items are in English because that is the way they come in. If the user wants to see anything in English translated to Spanish, they can click the MS Translator Widget button in the top right.
- Authenticated Users – Shows the page the way it is for a default English speaking user. No Panel display for the MS T. Widget. This is the way a user would come in from the Facebook login as well. But, anyone can hit the dropdown switcher and get the same experience that someone will get from having an account that specifies spanish.
- Anonymous – Shows the login block and a limited version of the RSS Feed via a cloned view from the original. That way it updates the same way but the links are not enabled and the user is encouraged to sign in to the site to get more content.
This is great! Now what I have to do is place that MS T Widget on the pages that aggregator outside content (via RSS and email) so that a spanish speaker can read them natively. VERY VERY NICE!
This is actually turning out better than I expected. And one of the things that I have discovered is that the Translate Interface interface (as seen below) is the key. But also, that you don’t have to have everything listed here translated for most sites. For example, i have found that about 33% of my Views being translated, as it shows here, is actually about right for my site. Much of what isn’t translated are system areas that my members will never see.
So, go through the interface from the perspective of the alt language user and find the text strings that need to be changed, do a Find on them in the interface, and then change them. Much will be case by case. But be flexible; you may decide to change more than you need at the time so that the future stuff will already be in place.
I need to be able to let applicants specify what language they want to use in the user registration. I believe that this module will allow me to change things on the registration form. When I am done, i’ll update.
Oh, and there is a language setting that allows the site to pick a language based on the browser’s settings. i believe that this will work for Spanish speakers that are logging in through FB.
I have been working with the Multilingual stuff all day and I think I have it at a point where I’m OK with it. I simply needed to play around with the interface myself for a bit and get used to it. But I believe that I can say that it is the quirkiest part of Drupal that I have had to work with. But once I got a steady rhythm going I was able to knock out things pretty easily.
I also enabled the session option for Multilingual and set its priority to first. That way, I can use Panels to add the Language Switcher Dropdown to the main page. So, with the language specified on the account settings and the dropdown enabled, spanish speakers will get spanish first with the option to change the language from the main page. English speakers get the same options.
Well, I really know why now they say to only attempt Multilingual if you have a brand new site. I don’t even have much content but just changing one menu with 9 items took about 30 minutes. And that was just to change the link name on the menu.
I am not going to go too far into this subject except to say that this is the toughest part of Drupal that I have encountered. There is a lot of ambiguity and a lot of clicking.
Here is what I did to change the items on an existing menu so that someone whose account specifies spanish will see the options in spanish while someone using the defaults of english will still see them in english. This assumes that you have all the same modules installed that I have. Buyer Beware on this. I make no claims that it will work for you the same way.
- Edit the menu and set it to Translate and Localize
- Click the translate tab and translate the title of the menu
- Click List Links
- Edit each English link and set it from Language Neutral to English
- Save it
- Go back into the item and click the Translate tab
- Provide a translation
- Do this for all the links then reorder them so they appear as you would like them
If you don’t save after you change the link from Language Neutral, the translation won’t take. It’s a quirk. At least with the combination of modules that I am using. The point of this is, you can make all this work but it can be tedious and requires a really thorough understanding of all the options. Which I don’t have right now. I’m just trying to achieve a fairly limited scope.
TIPS – I’m Doing Views Now. This is a reason to sue variations of a View whenever possible. It will simplify the translation process for the interface should you decide to do that.
Leave a piece of content as Language Neutral if you don’t plan 0n translating it. otherwise, it won’t show up for user accounts that have the language other than the one specified on the content. it will simply vanish.
I am working on translating various menu items on the site today.
I am trying to change the Basic Page entitled “About DOCResource.org” along with its menu title. I have changed it in the Translate Interface and it doesn’t seem to take. So I am going into the content itself.
I believe that 8’s complete reworking of Multilingual capability will be needed because there is just a lot of ambiguity here.