This page is archived
We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.
Alternate resources
In this series, based on the O'Reilly book Using Drupal, 2nd Ed., you'll learn how to use Drupal core's multilingual features, along with the Internationalization suite of modules, when building a multilingual site.
See our guide Using Drupal Book by O'Reilly Media to access all of our tutorials related to this book. Each series covers a chapter (or appendix).
Additional resources
There are two main areas of translation for your Drupal site: the user interface and the content. The user interface text is mostly provided by the software, stored in the code itself. This is sometimes referred to as "hard-coded." While content is generated by users of the site, and stored in the database. Drupal core comes with the Locale module, which works with the user interface text and gives you a nice set of tools that lets you import existing translations, create or edit your own, or export your site’s translations for use on other sites. In this lesson we'll take a tour of the Locale module and discuss translation files, translating strings, language switching, and how to get a localized installation.
Additional resources
The first step to using any of Drupal’s multilingual features is installing a translation, so that Drupal has more than one language to choose from. As mentioned previously, you can use a localized distribution so that you install your language during the site installation process. Alternatively, you can easily add a language after you have installed the site by using the “Localization update” module. In this lesson we'll get the right pieces in place and get two different languages installed on the site.
Additional resources
Drupal Translations on localize.drupal.org
Using Drupal, 2nd edition
Using Drupal source code
With several language translations installed on our site, we need to make a choice about how and when Drupal will use our new languages. In this lesson, we'll review the Locale module configuration to make sure it is performing the way we want it to, by setting language detection and selection, and then enabling our language switcher.
Additional resources
You may notice that even though you are using a translation that you have installed, there might still be some untranslated text peeking out here and there. This will become more likely as you add contributed modules. Almost no site will have absolutely 100% language coverage out of the box, so you will probably need to translate a few items yourself. Drupal has a built-in system to do this with the Locale module, but there is also a contributed “Localization client” module which extends this core feature. In this lesson we'll take a look at Localization Client, see why want to use it, and how it works.
Additional resources
Localization Client project
Using Drupal, 2nd edition
Using Drupal source code
Not everyone wants or needs to install yet another module, and due to the caveats we mentioned about Localization client, it is still a good idea to be familiar with all of your options. In this lesson, we'll review the Locale module translation process, then enable Localization Client and start translating some text!
Additional resources
Localization Client project
Using Drupal, 2nd edition
Using Drupal source code
When it comes to translating your site’s content in Drupal 7, we have two possibilities. There is the core “Content translation” module and the contributed “Entity translation” module. They have quite different approaches to translation. So, in this lesson we'll compare the Content and Entity Translation modules, and take a look at how node translations work.
Additional resources
Video about the difference between Content and Entity
Using Drupal, 2nd edition
Using Drupal source code
With our interface taken care of, now we can configure multilingual support for our content. That is, we need to be able to identify which language a given piece of content is written in and then create translations. So, we already have articles, and we need to add a knowledge base to the site as well. For both of these types of content, we’ll need to identify the language they are written in, as well as provide related, linked translated versions. In this lesson we'll enable the core Book module for our knowledge base, enable multilingual content, and start translating our knowledge base.
Additional resources
So far we’ve got a nice start with getting our site translated, but everything is not quite smooth yet. We have translations for some of our content and menu items, but we're seeing all the content at the same time. You will also see some stray interface text still in English. To take our multilingual site further and really make it shine, in this lesson we're going to turn to a package of modules called Internationalization (i18n). There is a central Internationalization module, which comes packaged with a handful of other modules designed to work together to extend core’s multilingual features.
Additional resources
Internationalization (i18n) project
Using Drupal, 2nd edition
Using Drupal source code
Translated content on a Drupal is all shown at the same time by default. The Internationalization module will let you display only content that is relevant to the language currently in use, which is referred to as "content selection." In this lesson we're going to configure our site's content selection and the test it out to make sure it working as expected.
Additional resources
Before we can translate the various site-wide variables, like the site name or slogan, we need to let Drupal know which ones we want to make translatable. To do this, we’ll need to use the Variable translation module from the Internationalization package. In this lesson we'll enable a multilingual variable so that we can see how to translate the site name.
Additional resources
We’ve translated the site name, but we still have other stubborn text on the site that we couldn't select on the Variable translation page. Our content types for the site are still using English for the content type name on the “Create content” page, and for field names when making new content. In this lesson, to fix this up, we'll walk through translating content type names, the Title label on the content type, and also see how to tackle the field labels as well.
Additional resources
When using Drupal’s taxonomy system, we need to find a way to sync the terms that we create to keep the taxonomy selection limited to just the terms for a given language. We don’t want all of the different languages showing up at the same time when someone is looking at a vocabulary or individual terms on the site. We're going to work with taxonomy to create our site's forum. The Forum module’s containers and forums structure is built on Drupal’s core taxonomy, so it is also creating a new vocabulary on our site. The forums on our client’s site need to display the threads that follow the same content selection rule as the rest of the content on the site. That is, we’ll only show the forum posts for the selected language. The site will have preset containers and forums, and then users may post to them using whichever language they choose.
Additional resources
The last little thing we need to do to clean up our site is to get our Home tab in the Main menu translated as well. Everything else in the menu is now translated, but the Home menu item isn't from one of the other features we've created. It's just a regular menu item. In this lesson we'll enable multilingual menus and get that home page tab translated.
Additional resources
There are a lot of tools available for working with multilingual sites, and we've implemented the main pieces we needed to build the site that Blue Peak Fanatics needs. In this lesson we'll take a look at some more modules we might consider down the road.
- Language icons
- Language switcher dropdown
- Transliteration
- Translation overview
- Translation table
Additional resources
We built a nice, simple, easy-to-use site for our clients that gave them the tools they needed for discussions and a knowledge base. We set up a forum that displays only posts that are in the user’s language and a knowledge base book where all of the site members can create translations for the pages. The major need for this community was being able to use multiple languages and easily extend those languages in the future. Using Drupal’s core internationalization features with a handful of contributed modules, we have given them a very flexible multilingual solution. In this final lesson we'll tour the Blue Peak Fanatics site, discuss our implementation points, and review the modules and resources we used to build this site.
Additional resources
Using Drupal, 2nd edition
Using Drupal source code
Up next: Using Drupal Chapter 9: Online Store