Following on from part 1 (click here) of our look at website translation and localisation in Drupal, in this edition we’re looking at creating multilingual websites in Drupal versions 7 and 8. So if you’ve developed your website in one of these more recent versions of Drupal, here’s how to go about setting up multilingual sites:
Drupal 7 was released on 5 Jan 2011 and multilingual support is (partially) included in the core. Building a multilingual website can require the download, installation and configuration of several contributed modules. There are two areas of a Drupal website that need addressing in order to make it multilingual – localisation (translating the interface, button texts, drop down menus, messages etc) and translating the content of the website.
You’ll need to enable multilingual support for each content type before content can be associated with an installed language. Once enabled, a translation tab will be appear, prompting two alternative approaches to consider – Content (Node) translation and Entity (Field) translation.
The newer Entity translation module, which allows particular fields to be translated and creates single entities, has several advantages over the old Content translation method:
- Uses one entity for all languages
- Single menu item per language
- You will be able to migrate the website more easily to Drupal 8
The key steps in creating a multilingual site with Drupal 7 are:
- Activate the core Locale module.
- Download, install and activate the Entity Translation and its Entity Translation Menu module.
- Download, install and activate the Title module.
- Download, install and activate the Transliteration module.
- Download, install and activate the Variable module.
- Download, install and activate the Internationalization (i18n) module and the sub modules Field translation, Block languages, Menu translation, Path translation, String translation and Translation sets.
- Go to the languages interface and add a new language to the list.
- Add a Path prefix language code to each language.
- Download and import the translation package for the language(s) you add.
- Activate the Language switcher block and set the region where it is to be displayed.
- Enable Multilingual support, with entity translation for each of the content types that you require.
- You can choose to build a single menu for every language or build one menu with links that point to every language.
- Create separate blocks for each language, enter the translated content and assign the appropriate language.
Drupal 8 core has much more built-in multilingual functionality than previous versions which makes it much easier to configure.
Building a multilingual site in Drupal 7 can require installing up to 30 contributed modules, all of which need to be configured! In Drupal 8, all of this functionality (and more) has been streamlined into just four modules:
The new Language module now manages the general language handling needs of the system. Language detection and selection is much improved with language mapping features. Content language defaults and the user experience of assigning language are more configurable.
2. Configuration Translation
This makes things like blocks, menus, views, etc. translatable.
3. Content Translation
The Drupal 7 field-based Entity translation module has been incorporated in Drupal 8 core. This therefore applies to all kinds of content, including user profile fields, taxonomy term fields, commerce product fields, etc. Node built-in fields are also translatable. Translation can be configured on a content type basis per field and for some fields even on a sub-field level (such as image fields with alt text and title). Search indexing per language and access control per language is supported.
4. Interface Translation
This makes Drupal’s user interface itself translatable.
Another inclusion in Drupal 8 core is the Transliteration module, which automatically converts special characters such as “ç” and “ü” to “c” and “u” for friendlier machine names, file uploads, paths, and search results.
If you have any questions about website translation and localisation, whether you are using Drupal or any other content management system, please get in touch. We are award-winning website translation experts and can help you with your project. Email us at firstname.lastname@example.org or give us a call on +44 (0) 1926 335 681.