Building a Multilingual Site in Drupal 7 - Recipe 1
Recipe 1: A Simple Website in a Foreign Language
As we discussed in our first introductory blog post, Recipes for Building a Multilingual Site, not all Drupal installations are the same and nearly every site built with Drupal is different in one way or another. This same principle applies when developing multilingual websites. In this first recipe for building a multilingual website, we will address a scenario in which all content is displayed in a language other than English, no content translation is required, and the administrative interface is made available (localized) in the preferred non-English language.
So how do we accomplish this? Drupal, by default, comes out-of-the-box in English. With the release of Drupal 7 there is no way of getting around this, Drupal renders content in English whether you like it or not, unfortunately. The solution? Install a foreign language and set it as the default language. We can do this with the help of a core module called Locale.
So, how does it work? Since the interface text or strings are quite often the same in all sites, Drupal can use contributed translations to display this text in the preferred language. In this use-case we will also use a contributed module called Localization Update to install the foreign language. This is not a requirement, but it will make the process significantly easier. So let’s start by downloading and enabling these two modules. Once you are done, go to /admin/config/regional/language and click on the “Add language” link to add the language of your choice. Since we have the Localization Update module enabled, it should automatically have downloaded the available translations for your site in that language. As you can see below, it downloaded 4605 Spanish translation strings for me. You can now use your new foreign language interface.
Next, select the new language as “default,” and select “Save configuration.” Your site will now use the new language interface, moving forward. Due to the fact that we will not be using English, there is no need to configure the “Detection and Selection” settings. If you require both languages to be enabled, you will have to set it up. This is how Drupal will know when to show one language or the other. More on this in our next blog post so please stay tuned!
So this is all you need in order to have a simple website in a foreign language. In a nutshell:
1. Enable the core Locale module
2. Download and enable the contributed Localization Update module
3. Add the language of your choice
You’re all set! Pretty easy don’t you think? That’s why we love Drupal.
In rare occasions the contributed translations that you get from localize.drupal.org, through the Locale and the Localization Update modules, are not exactly what you expected. This is especially the case if the language you are trying to support lacks good translations. What do we do then? Wouldn’t it be great if there were an easy way to modify or even add translations for strings not yet translated? Guess what! There is a module for that too. It is called Localization Client. Simply download and enable it, and you’ll get an interface for doing so.
I hope you have enjoyed setting up your new multilingual website as much as I did. This simple recipe should be viewed as your foundation for setting up multilingual websites in the future as this is a very common first step for developing multilingual sites. If you have questions or concerns about the steps we just discussed, or if you have unique requirements for your multilingual website don’t be shy! Please feel free to leave a comment, and you’ll hear from us soon. Stay tuned for our next blog post where we will dive into how to setup a Blog Site displaying multiple languages.