Freedom, Community & Sustainability

Seamless Drupal 7 multilingual site

November 7, 2011 -- William
Last modified on December 2018
Duration: +- 15 minutes

MultilingualDrupal 7 introduced new features that make multilingual sites much easier to handle. But Drupal itself is not trivial and you might get lost when you need to have your Drupal site divided into several languages. In this tutorial I will try as much as possible to make a step by step process and give some explanations and insights on how each aspect of multilingual sites work so that you can choose what are the best options for you. At the end you should have a Drupal multilingual site up and running without a glitch.

We will go through:
1 - The core features of Drupal 7 for multilingual sites.
    -Add languages
    -Detection and selection.
    -Translate interface.
2 - Some additional modules for translations in Drupal 7.
    -Localization Update
    -Localization client
    -Global redirect
    -Translation Management Tool
3 – Fine tuning.
    -Switching languages
    -Translating menus
    -Machine translations on the fly
4 - Multilingual for developers
    -Writing code for multilingual sites
    -Views + Features bug

1 - Core features

The core modules for multilingual sites are Content translation and Locale. With these two modules enabled you already have a multilingual site running.

Add languages

To add a new language go to .../admin/config/regional/language and click on 'Add language'. You can also decide what will be the default language, what is the path prefix (ex: www.example.com/fr for french) or the language domain (ex: fr.example.com for french).

With path prefix you will have one site with several languages, with language domain you will have several sites, one for each language. If your goal is to have the same content translated into several languages I would advise choosing path prefix but, if each language has a different content, a different administrator and different users then language domain might be the best option. Think well before choosing because it would be painful to change this once the site is online (it would break links to your site...).

If you want your visitors to go first to the default language and choose their preferred language from there, leave the path prefix or language domain empty for the default language. If you find more convenient to try to guess the user language, then add a path prefix or language domain to all languages, including the default one.

Some sites will allow mixed languages (different language between content and interface), having “Language neutral” nodes or displaying the original node if a translation is not available. I would advise against mixing languages in a public site. If you do so, your site could be indexed by search engines with a content and keywords in the wrong language. While your node is not translated you will be displaying duplicate content* and once you translate it, some users will be directed to a page that is not in their language. *(Note: see comment from Kristen about the module i18n_redirect being able to avoid duplicate content).

Detection and selection

Drupal offers many ways to deal with user preferred language. You can use one method alone or several methods with a priority order (if one method fails then the next one will be applied). This option is under .../admin/config/regional/language/configure. Here is how each method works:

URL (prefix or domain) is probably the best solution for most sites. Be aware that you might have a small problem with path prefix but it has an easy solution. The problem is that there might be inconsistencies between the site content and the site interface. If you have, for example, an “About” page translated into spanish “Sobre” you can access the page www.example.com/en/about (the content and the interface are in English), or the page www.example.com/en/sobre (the content is in Spanish but the interface is in English because of the prefix), or www.example.com/es/about (...you got the idea). When Search engines crawl your site they will mix up all languages and confuse visitors. To solve this you should install the module Global Redirect in order to make interface and content consistent. We will talk about Global Redirect module later on.

Browser can be very nice but it should not be the first detection method because users wouldn't be able to switch languages manually (they would have to change their browser's preference). When changing languages manually, only the content will be displayed in the user selected language while the interface will be in the browser's language. Manual language selection wouldn't work at all if Global Redirect is enabled (with the option to keep content and interface consistent). I use the browser detection method only if all languages have a prefix and URL is selected as the first detection method. This means that users that type in a URL path with the language will be redirected to that language (www.example.com/it = italian version of the site) but if someone in Italy type only www.example.com he/she will be redirected to italian if his/her browser is italian, or to german if his/her browser is german and so on. (Note: see comment from Reinhard about issues with browser detection and cache).

I found that URL as first method and Browser as second method with prefixes to all languages (including default) is the best detection and selection method I could choose so far.

Session will append a session variable to your URL (www.example.com?language=es). It is not such a good idea because it prevents pages from being cached (the site will be slower) and session can be a a problem because it will serve different content for a same URL. Google can handle session information although you might have to explain it in your Google Webmaster Tools. Overall it's not as straight forward as URL path or prefix. If you use URL and Session you will see that sometimes the session will not force a URL change so the language negotiation will be very inconsistent. I do not recommend using both URL and Session. There is also a thread in Drupal.org against the use of sessions.

User preferred language is probably a bad idea because it means users will not be able to switch languages easily and temporarily when they are signed in. Once the user is signed in, he/she will have to change languages in his/her profile instead of just using the default language switcher. This might be counter intuitive and annoying particularly for bilingual users.

Translate interface

Drupal core also offers a way to translate your site interface and import translations from localize.drupal.org. This is under /admin/config/regional/translate. Although this works fine there are some additional modules that can dramatically improve the core functionalities.



If you enable the i18n_redirect module (from the i18n module suite), then you can use language neutral nodes without penalty of having duplicate content on your site.

Submitted by William on
Hello Kristen, Thank you for pointing that out! I've added a note on the text about your comment. Thank you for mentioning this tutorial in your site! ;) I'll also take the opportunity to mention to other readers that you wrote a very good book about Drupal multilingual websites! http://www.packtpub.com/drupal-7-multilingual-sites/book

...only works for anonymous users when page caching is turned off. This is to prevent cached pages being served in the wrong language. For example if an Italian visitor has visited a page, and a french visitor comes next, the French visitor would be serves the page in Italian from the cache. This is bad, of course, since caching should almost always be turned on :-(

Submitted by William on
Hi Reinhard, Thank you for this information, I'm just wondering what is the detection method you are using in the URL? I think this is likely to happen when using the Session variable but not when using path prefix. Do you have also the Global Redirect module enabled? I haven't tested to check these issues but I was just wondering. Anyway, I've added a note about your comment in the text. Thanks again!

Submitted by Soulemane (not verified) on
Hi! I am about to develop a multilingual web site : english, french and arabic. I have been trying to find out how I will carry out this critical project, giving that it is my first one with multilingual site. After reading your article I felt a huge relief. I am therefore taking this opportunity to extend you my gratitude. You have done a good job. It has just saved me a lot of time. Keep it up. Thanks

Submitted by William on
Hi Soulemane, Thank you for your comment, I'm really glad it was helpful! I'd be curious to know how your multilingual project went!


Add new comment