Want to make your Drupal 8 website international? Check out these 3 tips that will help you adapt content to your target markets.
Subscribe to our blog
Drupal 8 has several out-of-the-box tools to support content management for multilingual websites. For many websites, Drupal’s so-called content translation features are enough, as they allow editors to easily translate pages and other types of content.
But what if your website needs to focus on regional-dependent content and what if some of your target regions have multiple languages? This is where it can get tricky, and from an editorial perspective, quite cumbersome.
If you’re looking for tips on how to build a multilingual website or how to make your Drupal 8 website international, fear not - we’ve compiled the three key tools you need to adapt your site to your target markets.
1. Use your target countries as taxonomy terms to create country-specific pages
Having a website with country-specific content (also referred to as region-dependent content) may imply a country and language selector that looks like the image below.
Visual language and country selector in a Drupal 8 website
By default, Drupal offers an out-of-the-box language selection block, which is not as visual as the example above. In order to build such a user-friendly country selector, you can use taxonomy terms and create specific vocabulary for countries that need to be shown in this list.
Editing taxonomy terms in Drupal 8
As languages in Drupal 8 are entities, they’re referenceable. This means you can assign each country to an available language on the website. In order to have a specific URL for each country/language combination, you can use language URL prefixes.
Note that some countries can be assigned multiple languages. Belgium, for example, has three official languages: Dutch, French, and German.
Using language URL prefixes to create dedicated URLs for each country/language combination
Clicking a country in the country and language selector brings the visitor to the homepage of their chosen language. In order to remember the visitor’s preference, the chosen country/language combination is stored in a functional cookie (Language Cookie module).
By using the solution described editors can tag certain content on the website to a specific country, and thus create overview pages that only show the content that’s relevant to the country chosen by the visitor.
2. Use fallback languages to improve translation workflows
Having a website with several countries and languages can entail a lot of manual editorial work.
When you have a multilingual website and need to guarantee that content is always available, you should specify a fallback language. For instance, in the Netherlands, and partly in Belgium, the same language is spoken, namely Dutch. If you use a language fallback system, it’s possible to define that if a certain piece of content is not translated into Dutch (Belgium), then the Dutch (Netherlands) version of this piece of content is presented to the visitor. This behavior will also happen in an invisible way, meaning the URL doesn’t change to the Netherlands version when visiting the Belgium version (so the fallback mechanism goes unnoticed to the visitor).
Languages can have multiple fallback languages defined, this way it’s even possible to set, for example, International English as the lower fallback language for all languages available on the website.
For the Dutch example above, the language fallback settings could look like this:
Setting a fallback language
This obviously minimizes the work for editors as it might not be necessary to have different translations for all country/language combinations.
3. Disabled languages - keeping SEO in mind
In the previous International English language example, the sole purpose of this language can be to have it available as fallback. However, you might not want visitors to end up using this as an official language on your website.
In this case, it’s a good idea to “disable” this language, not only for visitors, but also because search robots will not use this language to index your site. Editors will still be able to use the language in the back-end.
Jochen Verdeyen is a DXM Technical Consultant at Amplexor, based in Belgium. Specialized in Drupal CMS, Jochen has been developing enterprise websites for organizations across industries for more than 10 years. He’s a certified Scrum Master by the Scrum Alliance and an Acquia Certified Developer.