![]() ![]() I struggled a little doing multilingual sites in Drupal 8 the same way I was used to in Drupal 7 because node translation is not available anymore (which is good) so I had to find another way to achieve the same easy to handle translations system. We used to separate languages from each other using the various i18n modules, language specific menus, blocks, URL-patterns, terms and so on. We mainly used node translations in Drupal 7 for maximum flexibility. Since Switzerland has three official languages (German, French, Italian) and even one more national language (Rumantsch), we are used to this requirement and we found our way with Drupal to make this an easy task (usually). Just paste this code in your CUSTOMTHEMENAME.As a Swiss-based Drupal Agency, we have to create a lot of multilingual sites. Let’s tackle this one with a preprocess function. Besides, we consider our visitors as tech-savvy, so we can probably suffice with showing only the language codes as our links: EN and NL. Just place this in the of your custom theme where you want your language switcher links: Īlthough it’s probably best practise to fully write out the available languages - English, Nederlands, Francais - we could do with some more sleek minimalism. Luckily, Drupal 8’s Twig templating system makes it pretty easy to render exactly what we want. We don’t need a block title or any of those pesky elements, we just want an HTML list with links, for example: In order to control the output of the language switcher block, we want to be able to render the necessary links only. However, as we like our site sleek and minimal and consider our visitors tech-savvy, we would like to customize the links and determine exactly where and how the language switcher links get rendered. It shows all added languages written out fully, like so: ![]() It can be enabled, placed as a block in the region of your choice and it pretty much works. Let’s talk about the language switcher in Drupal 8. Things are never exactly how we (or our clients) want them and that’s fine. So Drupal 8 solves every pet-peeve you could’ve had with multiple languages in a single site perfectly and for good. And of course, to enable Drupal site builders to create multilingual sites out of the box. A lot of internationalization functionality was moved to core in order to improve maintenance and support. Its architectural overhaul simplified the structure, thereby making internationalization of content much more logical and efficient. Almost.Īdmittedly, Drupal 8 has made it easier than ever to support multiple languages. Whereas multilingual sites in Drupal 7 often required a plethora of internationalization and translation modules, combined with some custom code, Drupal 8 was going to solve all our multilingual headaches once and for all. Our clients are mostly Dutch, but many cater to an international audience or operate beyond borders, so by now there quite a few multilingual websites in our portfolio.ĭespite the potential complexities multilingual websites may pose, Drupal has always been notoriously adamant about supporting all languages - including those with non-latin scripts and those read from right to left. We switch back and forth without even noticing and have learned to read, write and conduct business in both languages effortlessly. As a creative digital agency based in Amsterdam, we’ve gotten used to having two languages of conduct: Dutch and English. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |