Skip to main content

New Language Hierarchy release for Drupal 8

An article from ComputerMinds - A leading UK Drupal development agency since 2005
21st Jan 2020

James Williams

Senior Developer

Do you want to reach more markets and people? Do you want to tailor your content for clients from a range of locations around the world, without having to manage every single translation? Then the Language Hierarchy project could be for you! I wrote a while ago about how this module gives editors more power and flexibility without the extra effort that can come with each translation added to a site. Now Drupal 8 sites can use the project with confidence, as I produced its first stable release candidate for Drupal 8 last month! 

Thank you to all those that contributed towards pushing Language Hierarchy towards this release. Especially to Julabo GmbH and ComputerMinds, for sponsoring my recent work, as well as SPX for giving us the opportunity to develop most of the features for a real-world use case in the first place. Also Gábor Hojtsy for his 'Sublanguage' sandbox, which was the foundation of the Drupal 8 version of the module.Languages can be dragged and dropped into a hierarchy on their administrative interface.

Drupal is already a fantastic solution for managing multilingual content. Adding Language Hierarchy means you can configure languages to 'fall back' through a hierarchy when a translation is missing. This means that you can set up all sorts of specific languages to ensure that your content is tailored to the different countries that you are reaching with less work. It can also stop unrelated translations showing when the correct translation is not in place yet.

For example, a Swiss German language could be set up, falling back to standard German. All your Swiss German pages would initially be set the same as in standard German immediately, without any pesky English showing through. Then as you tailor some content specifically for Switzerland, the rest of your Swiss German pages will continue to show any updates that your editors make in standard German. No duplication of effort!

Sound good? Here are some more clever things that the Drupal 8 version of Language Hierarchy provides... listed with some of my favourite flags of countries, just for fun :-)

  • 🇦🇴   Every different kind of translatable content uses the language fallbacks: nodes, terms, menu items, blocks, paragraphs, etc.
     
  • 🇧🇷   Your site interface will be translated according to the language hierarchy, not just your content. (The Drupal user guide explains the difference between content and interface translations.) So translate your parent languages first, and all your child languages will immediately stop being in English, before you even start customising them further!
     
  • 🇨🇫   Without the Language Hierarchy module, views listings can either entirely miss out content that hasn't been specifically translated for a language, or will show fallback translation as well as existing translations. This new release allows you to filter views to ensure (only) the most relevant translations show instead.
     
  • 🇯🇲   Translate your configuration in a 'parent' language, and its 'child' languages will use those settings too. No need to go set them for every one of your languages!
     
  • 🇲🇭   Build your language hierarchy by simply dragging and dropping the languages between each other on the admin page, just like you can with taxonomy terms, as in the screenshot above.
     
  • 🇵🇼   Drupal has its own fallback system for URL path aliases, so you can use a 'Language Neutral' path for a page which will cover all its translations (even if translations have their own paths too). Use this patch for Drupal 8.8, which we're looking to build into Drupal core itself, so that your path aliases can fall back with the same hierarchy that your content uses. 
     
  • 🇹🇹   Automated tests are included so we can verify the project's stability as Drupal evolves. But more are needed before a fully stable release can be made.
     
  • 🇬🇧   All sorts of other bug fixes and tweaks 😊
     

Development on Language Hierarchy will continue of course, not least ahead of the release of Drupal 9. All contributions, such as feedback, testing, sponsorship or patches are very welcome. There is always room for improvement! The project's issue queue is a good place to start if you can help. If you need assistance with your multilingual web project, leave a comment below, or get in touch with us at ComputerMinds.

Photo by Vladislav Klapin on Unsplash.

Hi, thanks for reading

ComputerMinds are the UK’s Drupal specialists with offices in Bristol and Coventry. We offer a range of Drupal services including Consultancy, Development, Training and Support. Whatever your Drupal problem, we can help.