| Drupal

tutuploadsmedia_1326929592271.png There are many different languages available for a Drupal installation, but what if you want to have a site with more than one language? Drupal is up to the task, but it's not a trivial procedure. There are two areas that need translation.

First, you'll need to translate the interface, which includes the button texts, drop down menus, messages and other languages you use to interact with the site. Customizing the interface is fairly simple, and there are language files you can download that will help you make short work of it. Drupal developers often refer to this as localization.

Second, you'll need to translate the content. There are some modules that will make this possible, but this does require more effort than translating the interface.

Let's take a look at how you can translate the interface and the content.

Step 1: Download and install modules

These are the basic modules you must have to make the translation work. Download and install and enable all of these modules before moving on.

Step 2: Enable and configure Locale


This is a native module and will be found in the core section of the module page.


Start by making sure that the Locale and Localization Update modules are installed and enabled. Localization Update is added when you install the Entity Translation module.

Step 3: Configure languages


Go to Configuration and scroll down to the Regional and Language section. You will see two new options: Languages and Translate interface. Click Languages.


On the Languages page, click Add Language.


In the PREDEFINED LANGUAGE section, choose a language from the drop down menu. If you don't find the language you want, you can define your own language. That's beyond the scope of this tutorial. You can find downloads of contributed languages on this site http://localize.drupal.org.

Add all the desired languages and then save the configuration by scrolling to the bottom of the screen.

Step 4: Choose a detection method


Check the box next to the method you want to use. Scroll to the bottom to Save Configuration.

Warning: do not disable or change the default language. This will cause serious problems and unexpected results. Your default language doesn't have to be English. If you used one of the international versions of Drupal, leave whatever default language you started with.

Step 5: Configure Translation Updates


From the Translation Updates tab you can configure automated updates for your language files.


Go to Configuration, then in the Regional and Language section, click on the other option you just added "Translate Interface" (see Step 3 if you forgot where it is). Here you will see various tabs that allow you to import, update and manage the interface strings.


The language file you installed will do the most common translations for you. Using the tools on this page, you can search for and find any string (line of text) you want to translate.

In the image above I searched for the string "An AJAX HTTP error occurred." The string must be entered exactly as it is shown on the site. Click edit to start translating the string.


You can now add the text in the various languages so that the string will be translated for those languages. If you don't enter a translation, the string will still be visible to the user, but only in the default language.

Step 6: Add the translation to the website


Enable the following modules if you haven't already done so.

  • Entity Translation
  • Title
  • Internationalization
  • Entity API
  • Variable

After enabling these, go to Structure, then Content types.


Click edit on the content type you wish to work with.


Click Publishing options and enable Multilingual support.

  • If enabled, a language selection field will be added to the editing form, allowing you to select from one of the enabled languages.
  • You can also turn on translation for this content type, which lets you have content translated to any of the installed languages.
  • If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.
  • If entity translation is enabled, it will be possible to provide a different version of the same content for each available language.

Click Multilingual settings. Choose your extended language options and support. Click Save content type. Repeat this for each content type you have on your site.

Step 7: Make each field translatable


Go back to the content type you are editing and click on manage fields. You will now see the Title on the manage fields tab has an option to replace it. Click replace.


If you check Replace title with a field instance, the title legacy field will be replaced with a regular field and will disappear from the Manage fields page.


You will now get a confirmation message.

Step 8: Activate the language option for each field


Click the field name in the Field column. You will need to do this for each field included in the content type.


Check the box to allow the field to be translated. Save the field settings.

Step 9: Create some content


Click Add content and add a content type that you have already enabled multilingual capabilities for. Choose a language and save your entry.


After you've saved it, there will now be an additional tab on the editing page. Click Translate.


Click add translation in the new dialog box.


Make the translations and save your work. In the example above, I've done the French translation for the title and the body.

Step 10: Repeat for each language


Do the same for each language you want to use on the site.

Step 11: Add a block for the language switcher


Go to Structure, then Blocks and find the Language switcher (Content) and Language switcher (User interface text) blocks.


Add one or both of these to your site by specifying the position.


Click Configure on the block page. Click Languages. Choose the visibility settings. The default is to show regardless of language.


In the image above, the block is positioned in the footer. Clicking an icon or a word will change the site language.


Here's a picture of the page after I clicked the Afrikaans flag in the block. Notice that some labels are not translated. You'll need to address those individually as described in Step 5. It may be translated in a language file update at some point in the future, or that word may not exist (or be the same) in the language you chose.

Now you know how to add both interface translations and content translations to a Drupal site. There are a lot of steps and it's easy to get lost in the process. Work slowly if you're a novice, and make sure the early steps work before you move on.