Introducing Drupal 8 Multilingual Capabilities
Having a multilingual website means all content, from what's visible to guests, to the administration interface, can be translated into other languages. Drupal content translations are insanely easy to configure and execute in Drupal 8 compared to prior versions of Drupal.
If you're upgrading (migrating) from an older version of Drupal, the translations can now be migrated in a much simpler manner in most cases.
As with many other features of Drupal 8, the ability to create multilingual sites out-of-box was considered so important, it had its own core initiative. Having built-in multilingual capabilities means superior ease of use, and every entity has the same translation workflow.
Before we dive deeper into translations, it's important to understand in Drupal 8, just about everything that makes up the underlying architecture is considered an “entity”. This is a huge break from prior versions of Drupal as entities were broken up into distinct categories, such as node (page), field collection, and so on. Also, things like blocks (e.g. the header and footer of any site) were not considered entities.
Why is this important? All entities in Drupal 8 may be translated using a simple UI and the same steps. You can even configure a workflow to approve translations in every language before they become visible to your guests.
Test-drive this Feature on this Demo Site
The Four Core Drupal 8 Multilingual Modules
What is a Module? Drupal Modules provide plug-and-play features and functionality. Typically you can enable and configure them to make their feature and/or function available. Drupal has core modules that "ship" with Drupal, and nearly 7,000 contributed modules available for Drupal 8. Contributed modules are modules added and maintained by the Drupal community.
Drupal 8 "ships" with four built-in multilingual modules as follows:
- Language module: allows you to add and configure the languages you wish to translate your content into.
- Content Translation module: provides a User Interface (UI) to translate any Drupal site entity (page, block, menu, tag, etc.) into any enabled language.
- Interface Translation and Configuration Translation modules: provides the ability to translates the built-in UI that makes up the administrator interface and the authoring environment. Many translations have already been performed and can be downloaded on-the-fly.
If you're only concerned with translating the content you create, only the first two modules are required, and the later two haven't (yet) been enabled on this Drupal 8 demo website.
We'll cover these modules in more detail below.
Configuring the Drupal 8 Language Module
Drupal 8 makes it incredibly simple to add and manage languages to translate your content into. This Drupal 8 Demo site has the following languages (so far):
- English
- Chinese (Traditional)
- Spanish
- Portuguese (Brazil)
- Italian
The table allows you to set the default site language and edit each language.
As you can see, you can set our own name for the language, and the direction the text is to be presented in (left to right or vice-versa).
You can add as many languages as you like, with many built in to choose from, and a "Custom language" option for any language not listed.
Configuring the Drupal 8 Content Translation Module
The first thing that needs to be done with the content translation module is to select each entity type you wish to translate.
For this Drupal 8 Demo site, we wanted to allow translation of the following entity types:
- Content (pages)
- Custom blocks
- Custom menu links
- Taxonomy terms
- Users
As you add more plugin modules to your website, more items become translatable (if supported).
For every entity subtype within a given entity type, you then need to configure exactly what fields get translated. For example, content may include news, events, etc. If you wanted to translate all of your content types, you'd need to configure all of them.
As you can see, both built-in fields and fields made available through add-on modules can be translated.
Now let's have a look at how a page is translated. First we add the page in the default language and save it. Then we click the Translate tab at the top, and are presented with a list of enabled languages (configured above) to translate a page into.
We'll click Add for Spanish, and we're presented with a form to provide the Spanish translation, which is exactly the same as the page add/edit form less any common fields you didn't want translated.
Although we're showing a page translation, the exact same translation flow works for all translatable entities. It's just that simple!
More on the Drupal 8 Interface Translation Module
The Interface Translation module automatically downloads translations for parts of the Drupal front and back end interface you see after logging in. If you don't agree with the translation provided, you can override it. If you added a custom language, you will be responsible for all of the translations.
Here's a helpful hint for translating your default language: enable this module, and you can actually provide overrides for built-in interface items. For example, change you "Log in" button to "Sign in". Neat!
Any customizations you make to one site can be exported and used on another site.
A UI is provided to help you manage the translation of these items.
Conclusion
If you have had the unfortunate experience of configuring or just using the content translation in prior versions of Drupal, you will be in for a very pleasant surprise at how easy it is now to both configure and add translations.
If you have a Drupal 8 site now, and wish to add multilingual capability, we'd be happy to help. If you have an older version of Drupal, you'll want to test drive this feature on this Drupal 8 demo site.