Drupal CMS for Multilingual Websites
Drupal is a free and open source content management system (CMS) based on PHP and MySQL. It’s a scalable, robust and extensible application that provides a rich plug-in architecture and a template system.
It was first released in January, 2001 by its founder Dries Buytaert. The purpose of Drupal was to enable others to use and extend the experimentation platform so that more people could explore new paths for development. The name Drupal, pronounced droo-puhl, derives from the English pronunciation of the Dutch word druppel, which means “drop.”
The most recent and recommended release at the time of writing is version 7.26, released on January 15, 2014. As of April, 2014, version 7.26 had 316,203 users.
In this blog, we will discuss using Drupal to support and manage multiple language websites. This will be the first post in a three-post series.
Preparing to support a multilingual website
Drupal includes the basic fundamentals needed to support websites in multiple languages out of the box. These features are made available as modules.
The following is a list of the out-of-the-box modules which must be enabled to support multiple languages within Drupal:
- Locale – Adds language handling functionality and enables the translation of the user interface to languages other than English.
- Content translation – Allows content to be translated into different languages.
To enable these modules, follow the steps outlined below:
- Go to Modules – To access the Modules section of the Drupal administrative area, simply click on the Modules link at the top of the screen as shown below:
- Check the box for both Locale and Content translation.
- Click Save configuration.
Enabling languages on content types
When you create content, the content’s type must have multilingual support enabled before you can associate the content with an installed language. You must enable this feature for each of the installed content types on your site.
To enable translations for a content type:
- Go to Structure > Content types.
- Click the edit link next to the content type for which you are adding multilingual support.
- Click the Publishing options tab.
- Under the Multilingual support section, select Enabled, with translation option.
- Click the “Save content type” button.
Once you have enabled multilingual support on your content types, you will notice a translation tab that is now available. This tab allows you to track all translation for any of your content types. In addition to the translation tab, a field is added to this content type that allows you to choose the language it is written in.
Selecting and switching between languages
Once you have enabled the languages for your site and configured your content to show in these languages, the final step involves providing a way for your website users to see your site in the language of their choice.
Fortunately Drupal makes this process simple and gives you several different options. You can configure your website to display visitors’ preferred languages based on their browser settings, IP address, URL parameter, or you can let visitors select their language manually via a language switcher.
Language detection mechanisms
Use the Detection and selection page to provide different language options to visitors based on criteria that you select.
To configure your website to take advantage of automatic language switching:
- Go to Configuration > Languages.
- Select the Detection and selection tab.
- Configure how your website responds to site visitors and how languages are displayed by enabling and configuring the following options:
- URL – Determine the language from the URL (path prefix or domain). For example, the ISO language code for Spanish is ES:
- A path prefix configuration – https://[example]/es/about-us.
- A path domain – https://es.[example]/about-us.
- Session – Determine the language from a request/session parameter. For example, use of the Language switcher creates a session parameter for the visitor.
- User – Follow the user’s language preference. For example, the user’s account language preference.
- Browser – Determine the language from the browser’s language settings.
- Default – The default site’s language that should be used for content.
- URL – Determine the language from the URL (path prefix or domain). For example, the ISO language code for Spanish is ES:
- Click Save configuration.
The language your visitor will see is based on your settings and the list of languages you installed.
Using the language switcher
When you enabled the Locale module earlier, it also enabled the Language switcher block. This language switcher block presents website viewers with a collection of links based on the languages enabled on the website. As such, users can now manually select and switch between each of the languages for your site.
To enable the Language switcher, use the following steps:
- Go to Configuration > Languages.
- Click the Detection and selection tab
- Select Session.
- Click Save settings.
- Go to Structure > Blocks.
- In the Disabled section, choose the Language switcher
(User interface text) block, and select the region where it should be shown.
- Click Save blocks.
The Language switcher block is now active and displays links to each of the languages on your site. When visitors click these links, the site switches to the selected language, changing all of the content and interface options for which translations are available.