Skip to main content
Image
drupal-8-multilingual-opensenselabs_1.jpg

How To Make Your Drupal 8 Site Multilingual

Drupal

According to a survey, 56% of users spend more time on sites in their own language than they do in English. 

Cost effective and increased traffic are not the only two reasons on why you need to opt-in for multilingual websites. 

blue image with drupal logo in centre and eight dialogue boxs around it

Multilingualism on the web has a huge business advantage. It saves an incredible amount of time and money while delivering a better user experience to larger audiences. 

Translating your website into multiple languages (or even one language) can be a big undertaking. And while things might seem easy, that might not be the case every time. 

Drupal 8 supports multilingualism out-of-the-box. It provides content translation in 94 languages. What use to take more than 22 modules earlier in Drupal 7 can now be done in 4. Drupal 8 is easy and efficient for multilingual businesses. 

In this blog, we will learn how to translate your Drupal 8 website in more than one languages. 

Drupal Modules to Make your Site Multilingual

The pre-requisites involve these four Drupal 8 modules. 

  1. Language
  2. Interface Translation
  3. Content Translation
  4. Configuration Translation
  • Language: It is the base component needed. This module is used for adding and choosing the languages. It maintains the list of languages on your site supporting every dependency to store information. 

    Allow Drupal to add and choose the language of their choice. Natively, it is available in 94 languages.
     
  • Interface translation: Translates the whole interface from the core and contributed modules. It translates the built-in user interface automatically and improved customization for translating custom.
     
  • Content Translation: This module translates all the content types and content entities. It has field level translations inbuilt in its API. Providing a language selector, it allows you to select the languages with just a checkbox. 
     
  • Configuration Translation: It allows you to translate text that is part of the configuration, such as field labels, the text used in views, field settings, etc. It also has a built-in responsive translation interface. 
“Keeping your website only in English means ignoring the next 75% plausible market.” 
a horizontal bar graph with yellow bars
Source: Designingit.com

Step to Make your Drupal 8 Site Multilingual

  1. Enabling the Modules

    Install Drupal on your system. The above mentioned four modules come out-of-the-box. 

    Go to Extend and enable all the four modules in the Multilingual section. admin interface with multilingual drop down and four rows listed below it
  2. Adding Languages

    The most important module is the language. It is used to install and select the language. 

    Since you have already enabled it in the previous step, choose the languages you want to configure.

    Go to Home > Administration > Configuration > Regional Language > Install language of your preference > Add language. 
     admin interface of languages and english set as default admin interface with french selected in the add language page
    Wait for the translations to finish downloading. Once done, you will be returned to the Language page, with a confirmation message and the new language will be shown as in the image below. 
     admin interface with french language added to the existing languages
  3. Enabling Language Negotiation

    To let users know of the other language options available, Drupal provides the language detection method which detects the most used language of the user. It then shows the user with a pop up to translate the website without forcing the user to do so. 

    You can set the language detection method of checking on the checkbox of your choice by going to Configuration > Regional and Language > Languages > Language Detection and Selection. 

    There are various built-in language negotiation methods available such as the following: 
     
    1. URL: This method is enabled by default and will be first on the list. If the language is specified in the URL then the page will be available in that language. In case it is not, then other methods will be preferred.  
    2. Browser: It detects if the user has configured any language preference in the browser. 

    3. User: It will show follow user language preference

    4. Selected language: it will show the language selected by the user from language switcher block

    5. Session: It detects the language from the session or request parameters. 

      You can create your own language detection method my making your custom module using API methods or contributed module like geolocation.
       

      admin interface with interface text language detection method selected as URL

       

  4. Placing the Language Switch Block

    Once the language module is installed, the language switcher block will be available by default. It allows the site visitors to switch between languages of their preference. 

    Place the language switcher block in the desired place on your website. However, this block will not work until you add translations. 
     

    admin interface with message of block configuration has been saved and two blocks below it

     

  5. Translating the Interface 

    Now, you need to translate the interface, the content on the page. This will also add options of available language updates for the user. 

    Go to Home >  Administration > Report > Available translation updates . 

    Check for the available updates. Click on check manually updates and if you have any updates click on update translations button and update all translations for you. 

    admin interface on available translation updates with languages selected as french and hindi

    Go to home page and change the language from the language switcher and check if the interface is translated to the language chosen by you.

    Here I have selected French in the language switcher block so my admin menu is now translated to the French. 

    admin interface of multilingual demo in frnech

    Home >  Administration > Configuration >  Regional and language > User interface translation

    Here we also have a user interface translation screen which is the hub for translation it provides the list of all the translated strings you can update it according to your choices. 

    Admin toolbar in french
  6. Translating the Content

    Now, enable the content translation module. It allows users to translate content entities. A new translated column will be added to all the content entities.

    Go to Home > Administration > Configuration > Regional and language > Content language

    Select the content type, taxonomy, menu link you want to translate your content into. After selecting the entity, you will have to choose all the fields. 

    Let’s say you selected the article content type. After that, a list of fields will appear from where you can select the one required to translate.

    admin interface with five options and three columns to save configurations


    Make the field inside content multilingual.

    Now we have an example of how to translate a node into the French language.

    Go to  /admin/content and search the particular node and in then from the operation column select translate from the drop down. 

    It is here that the translation page appears: 

    1. Note that the user interface has switched to French. To switch it back to English, remove the first instance of fr in the browser’s URL. 

    2. For example, if your URL looks like example.com/node/5/fr/node/1/edit, remove the fr that comes after example.com.

    3. Then add the translation according to your requirement.

    4. You have to translate your content into the required language by yourself. After translating your content save the node.

    admin editor interface with content on left and an image on rightadmin interface with translatable content type and configuration
  7. Config Translation

    It provides a translation interface for configuration and translates everything which was not translated before. 

    Enable the module. To translate the site information locate that configurations in your site. 

    Find the tab or link with label translate option. Add translation according to your requirement and save it.

    To translate the site information follow the steps:
     
    1. Go to the basic site settings. Click on the translation information tab.

    check

    2. Select the desired language which you have to translate and save it

    admin editor interface for basic site settings

Having a multilingual site is easy in Drupal. Here are some benefits for Drupal 8 multilingual site.

Language handling

  1. Natively install in 94 languages
  2. Simplified language configuration
  3. Two special languages instead of one (Not specified/Not applicable)
  4. Assign a language to everything (content and configuration alike, eg. pages, views, menus, etc.)
  5. English may be deleted
  6. Blocks may be language dependent and more page elements are blocks
  7. Better language selection defaults (URL negotiation enabled by default)
  8. Browser language detection made configurable with external language codes
  9. Newly configurable fallback selected language
  10. Admin interface language selection option per user
  11. Transliteration built-in for machine names
four icons placed horizontally


Interface translation

  1. Automated downloads and updates
  2. One central directory that may be deployed
  3. Batched imports for optimal memory handling
  4. Built-in translation UI revamped for easier editing
  5. Plural version editable on an integrated interface
  6. Protected custom translations, exportable
  7. English text customizable
  8. Default shipped configuration is translated

Content translation 

  1. Flexible language defaults configuration
  2. Freely position or hide the language selector
  3. Field-level translation configurability
  4. Optionally share an image between translations on image fields
  5. Applies to all types of content (taxonomy, user fields, products, rules, etc)
  6. Views integrated with flexible filtering and display options
  7. Integrated fully with core search as separate results
  8. Exposed language information via search API
  9. Per-language content access

Configuration management

  1. All configuration is translatable (roles, text formats, blocks, views, panels, etc.)
  2. Built-in responsive translation interface
  3. Overview screen for translators, contextual translation tabs for site builders
  4. All shipped config pre-translatable on localize.drupal.org

We specialize in Drupal development. Connect with us at [email protected] to build awesome web development services.

Subscribe

Ready to start your digital transformation journey with us?

Related Blogs

Drupal Recipe Module: What Is It & How It Works?

Drupal Recipe Module Drupal Latest Initiative - Recipes OpenSense Labs

Drupal 11 is now available, bringing new standards. The latest version combines code and design to enhance user experience. It features…

SDC: Integrating Storybook & Single Directory Component

Integrating SDC With Storybook OpenSense Labs

Today, we will talk about about Drupal Single Directory Components or SDC and Storybook. Single Directory Components in Drupal allows you…

RFP: How To Create An RFP For Open Source Solutions?

RFP OpenSense Labs

A good Request for Proposals (RFP) or Call for Proposals (CFP) clearly states the goals and expectations of your project and sets the…