How do you build a site with content in more than one language? This article outlines the features of Drupal that will help you build a multilingual site.
[An old, much more technical, article at this location was getting a lot of traffic from people looking for general information about Drupal localization, so I wrote this article to help them out. The old article can now be found here.]
Two long words: internationalization and localization
Before you can localize content, you first need to internationalize it. Many people get somewhat confused at this point so I’ll try to make the distinction between these two terms a bit clearer:
- Internationalization (sometimes abbreviated to i18n) is what provides the ability to replace a piece of content in one language by its equivalent in another. For it to work the system needs to know the language of each content item, and must be able to find any of the various translations that are available. So if you have an “about me” page in English, internationalization will enable you to create versions of it in other languages and have them displayed to visitors depending on their selected locale.
- Localization (sometimes abbreviated to l10n) is the actual process of creating translated content. Generally you’ll assign a translator a number of content items and they’ll create new versions in the appropriate languages.
So in making a multilingual site you’ll plan to start by internationalizing it as a one-time initial step, then perform localization for each language in turn. (In practice the localization process may reveal further things that need to be internationalized, so life is rarely quite this simple!)
The Drupal core comes with a basic internationalization mechanism via the Locale module, which allows text strings from modules to be translated using gettext tools. Its main purpose is to allow Drupal sites to be built in any language, which it does well enough. So you can relatively easily create a site in one language, be it French, Arabic, Chinese, Hungarian, Welsh or whatever, but creating a site in several languages at once needs some additional software. That’s where the Content Translation and Internationalization modules come in, which we’ll look at in more detail in the next section.
Content Translation and Internationalization modules
The Content Translation module, which was introduced in Drupal 6, provides basic internationalization for content. In most cases you’ll also want to install the contributed Internationalization module, to have a more comprehensive solution, covering:
- Nodes. Most content in a Drupal site is made up of nodes. Content Translation enables you to specify the language for each node, and to say that one node is the translated version of another. So if you have a “Help” page in English, you might create a new page, “Hilfe”, as its German equaivalent. German visitors will then automatically see the new page instead of the English one.
- Blocks. Blocks typically appear in sidebars and footers and can fulfil a multitude of purposes. You can use the Internationalization module to configure blocks differently by language, to give them language-specific titles for example.
- Menus. In a multilingual site, you’ll generally want to show users menus in their own language. With the Internationalization module you can create different versions of menu entries for each language used on a site.
- Taxonomy. Many sites use taxonomy to organise content into different categories. For example, you might have news articles about “Science”, “Sport”, “Arts” and so on. Using the Internationalization module, you can translate each category into its equivalent in each language.
The modules also provide administration interfaces for managing the localization process and a block for switching between languages.
You can download a number of language packs from the Drupal website and install them, but these are just the starting point for your localization effort. If you are paying a translator to carry out localization for you, don’t attempt to estimate their workload until you have installed all the languages you are going to use and made a comprehensive list of all the items that require translation.
In general, each contributed module you have installed will add some text strings of its own that may need to be translated.
From the administration panel you’ll be able to see how many text strings and other items there are untranslated, but – depending on how the site is used – not all items will need to be translated. Here are some common scenarios:
- Modest multilingual needs. Only a few pages are of interest to an international audience, or you can only afford to have a small number translated. It’s perfectly possible to limit your efforts to a subset of the content, though you may need to take care not to confuse or disappoint visitors who may expect to see more of the site in their native tongue.
- A brochure site. All your public pages require translation, but the site is administered by a small number of people who share a common language. In this case it’s generally simple to identify all the content items for translation from inspection of the publically visible parts of the site.
- A forum site. There’ll be a lot of user-generated content which can’t be translated, but you may opt to provide help, form prompts and messages in several languages. To ensure that every item has been covered, you will have to perform interactive testing. If there are moderators with special privileges who are non-natives, the interfaces they use will have to be tested thoroughly as well. Since most users will speak only one language, in general I would suggest that you create a separate forum for each one.
- Large multinational site. If you have a large site with many users in different countries localization will be an ongoing process rather than a periodic exercise and will need to be managed as such.
If you are building a site to be used internationally, there may be other things you need to address as well as the translation of text, including:
- Page layout. When you translate an item of text from one language to another the amount of screen space it occupies may vary greatly. A single character in Chinese might be a two word phrase in English or a lengthy single word in German. As a result, your carefully-crafted web page design might break. The solution might be to use a more flexible design, or to incorporate language-specific adjustments (which may be expensive).
- Locale or language? Many sites give you the option of switching language but strictly speaking it’s not language but locale that counts. A locale is a combination of country and language, such as US English, Swiss German and so on. The differences between one locale and another are not limited to language: the UK and US use different formats for dates, for example.
- Dates, times, numeric quantities and currencies. These items vary in the way they are presented from country to country, so you’ll want to them to change with locale. Unfortunately some modules aren’t fully internationalized in this respect so you may need to carry out additional development work to achieve it.
Drupal provides the basic infrastructure for your multilingual site, but it’s still fairly complex to set things up, so it’s likely you’ll need some measure of technical help along the way to get the right configuration and provide support for your translation efforts.
Lkemind Web Services has developed sites with content in multiple languages as diverse as Welsh and Japanese. Call us today on 07783 386951 to talk about your Drupal localization requirements.