How to create multilingual website in Drupal 9
Here we are going to discuss configuring multilingual in a Drupal 9 or Drupal 8 website.
Follow below steps for enabling the multilingual in your Drupal instance.
Step -1 :Enable multilingual modules
First install below core modules. navigate to extend page and install below modules.
Step-2: Add Language
Navigate to Configuration->Regional and language,
/admin/config/regional/language
Click on languages.
You can add multiple languages here. Add required languages here and save the configuration.
Add language by selecting language from language name dropdown.
Step-3: Enable translation in content types
Go to your content type edit page and enable translation in language settings pages.
Also select check box for showing language selector.
Under configuration select content language and translation.
Admin URL – /domain.com/admin/config/regional/content-language
You can see below page.
You can decide which field is translatable in each content type. Also, if you have paragraph’s, you can decide translatable fields in paragraph. You can also select taxonomy and taxonomy fields in this page.
After selecting options, hit save configuration button.
Now go to the Add content, you can see below language drop down where you can select language while creating an article content.
Also, while editing content, you can see translate tab where you can translate content to other languages.
Step-4 : Language Switcher
You can place language swither in any of the region in your theme.
Go to Structure->block layout
/admin/structure/block
Select Language switcher from place block pop up.
Here I have below region in theme.info,yml file.
lang_switch: ‘Language switcher’
and in twig, print the region variable.
{ page.lang_switch }}
Clear the cache, in block list click on place block button of below block.
You can see below language links displayed in page. Clicking on below links redirects to respective language sites.