Drupal 8 is a massive undertaking. It's already been 5 years in the making.
Why did it take so long? Partly because so many important contributed modules are now core features. Translation is a perfect example.
It used to take several contributed modules to make even a small multi-lingual Drupal 7 site. Now, you can translate everything using just the Drupal 8 core.
Here's our 5-step guide to building your first Drupal 8 multi-lingual site.
Step #1. Enable the translation modules
You will need to enable these four core Drupal modules in order to translate your site:
Step #2. Translate the Drupal core
First, let's translate of the core language inside the Drupal. In this example, I'm going to add Spanish as an option on my site:
- Go to Configuration > Languages
- Click "Add language"
- Choose your language and click "Add language".
Click on the percentage area, under "Interface Translation".
You'll be able to search for and manually translate all the language strings in here:
Step #3. Translate your own site set-up
- Go to Structure > Content types, you'll see a "Translate" option for your content types:
Inside the next screen, you'll see similar "Translate" links for all your fields:
Step #4. Add content
Now we can add content to your Drupal site.
- Go to Configuration > Content language and translation.
- Click the box next to "Content":
- Check the box, "Show language selector on create and edit pages".
- Now go and add content to your site. Thanks to the "Show language selector on create and edit pages" box, you'll able to choose the language you're writing in:
- After saving content, you'll see a "Translate" tab available:
- Click "Add" in order to create a new version of that content item:
Congratulations! You can now start translating your Drupal site. And you didn't use a single contributed module.
Step #5. Allow users to switch between languages
- Go to Structure > Blocks
- Click "Place blocks"
- Click "Place block" next to the "Language Switcher" block:
- Click "Save block".
- Go to the front of your site and the Language Switcher will be working:
One final nice touch is that the URLs were automatically configured. The URLs on my test site looked like this:
- /node/1
- /es/node/1