multilingual

By Gábor Hojtsy , 19 June, 2013

Up to date as of October 16th, 2015.

Once/if you have multiple languages configured on your website, selecting from them for the page becomes an important question. The Drupal 8 language detection and selection options are located the same place they were in Drupal 7 but almost all options got some improvement.

Useful out of the box

Drupal 7 only had the default language detection method turned on, so even if you kept adding in more and more languages (and even if you enabled the language switcher block), the URLs did not work. You still needed to get here and configure the URL detection method. Now this is built-in, so adding languages and placing a selector block would in itself make multiple languages accessible.

Image
By Gábor Hojtsy , 17 June, 2013

Up to date as of October 16th, 2015.

As I've outlined in the previous post Drupal 8 core now has 4 core modules to deal with language support. This tidbit will be about the simple language setup features provided by Language module, which is the base for every other language feature.

Image

Language module provides a simple language overview screen. You can reorder existing languages, remove languages (except the site default language, which on the screenshot is English) and add new languages. It is not anymore possible to have enabled and disabled languages on your site. This feature resulted in a confusing mess where some places and permission combinations allowed for the use of disabled languages and it was used as a means to stage certain new content. Just use proven content staging techniques (or unpublished posts) for new language content.

By Gábor Hojtsy , 12 June, 2013

Up to date as of October 16th, 2015.

Once you install Drupal 8 in a foreign language, you'll have Language and Interface translation modules enabled with the chosen language configured. Drupal 8 has more core modules handling language related features, yet less requirement for contributed modules to be installed for the most important tasks (on my last count, the 4 modules explained here cover functionality of 20+ modules from Drupal 7 and in much better ways).

Why have multiple modules when a multilingual site just needs all the features? Well, there are also foreign language (not multilingual) sites that we aim to support better and multilingual sites can be very different as well. Also, admittedly there are technological reasons to organize the modules by the features they provide.

In Drupal 8 multilingual is one of the groups of core modules, so you'll find these modules under the main core modules in a neat group.

Image
By Gábor Hojtsy , 11 June, 2013

Up to date as of October 16th, 2015.

Starting a new series

The Drupal 8 Multilingual Initiative was announced on May 9th, 2011. Since it's inception, the heroic efforts of people on the initiative resulted in hundreds of issues resolved but there are always more to perfect. We have made huge advances in terms of multilingual support in Drupal 8 thanks to all these changes and you can still help to make it perfect.

I'd love to highlight some of the great improvements that we made to make you excited about what is coming and point out some related places where you can still help to perfect what we have so far. This is number one in a series of short posts to discuss these improvements.

Language first in the installer

Drupal 8 makes language occupy the prominent first step in the installer. And compared to Drupal 7 where you were presented with a wall of textual instructions as to how to locate and download a translation file, place into a specific directory and reload the page, Drupal 8 comes with the realization that these are all tasks we can automate. So we show you about a 100 languages to choose from to install Drupal 8 in.

Image

The new Drupal version also comes with highly improved browser based language detection capabilities, so it will attempt to automatically identify your preferred language for this installation based on what your browser tells us. So in most cases, you'll likely just hit the button to continue and not think much about this.

We not only present you with the list of languages, we also download and import the translations to your system proper. So all the steps you did manually before are now automated. The installer can also fully show up in right to left languages.

Image

Also, if you pick a foreign language here, English will not be among your site's languages anymore either. Drupal 8's assumption is that if you install in a foreign language, you likely want a foreign language website without English showing up at all kinds of places as an option. Compared to Drupal 7 where English was not possible to remove.

By Gábor Hojtsy , 30 May, 2013

I've had the pleasure to present the current state of the Drupal 8 Multilingual Initiative - great work of numerous highly respected individuals - just last week in Portland at DrupalCon Portland 2013. Although I did do live demos at previous editions of this session, at this point we have just too many great improvements, that it does not fit anymore. So for this session, I opted to provide a better overview and more context as to how this affects site building in general for Drupal 8, including the extent of change as it applies to contributed modules.

We are still working on several key pieces of the initiative, and will have meetings every Wednesday leading up to the code freeze coming July 1st, 2013. Join on our meetings to help with the remaining tasks. We have tasks for all experience levels!

Download the slides from https://portland2013.drupal.org/sites/default/files/slides/D8MI-Portlan…

By Gábor Hojtsy , 19 November, 2011

After reviewing language support and translation for many of Drupal's pieces, we arrived at a pretty complex question, building multilingual navigation. The question is especially of importance because we often need to put translated content in menus, and the cross of translation of content and translation of menus can easily get us into the woods. Let's build some simple solutions for different use cases to see how to think of multilingual menus.

By Gábor Hojtsy , 28 September, 2011

I know many of you faced the goal explained above. There are tools of different levels of involvement and there is of course no ready-baked answer to this question, but here is my best take so far for the current two active versions and Drupal 8 in development.

The three areas of Drupal language support

(A) First off, you can run a single language foreign language website without a need for content or configuration translation. Because the Drupal user interface comes in a flavor of English, you'll need to translate that. But all your content and configuration can be entered in your language, so you are fine there.

(B) Second, if you need to mark your content with language information, such as if you are running a multilingual blog, where you post in different languages, but will not translate your posts, you need language assignment with multiple language options.

(C) Finally, if you need to have the same content translated, the same navigation replicated or similar navigation produced for different languages, you need translation for your content and configuration.

The three types of data for Drupal translation

When it comes to translation, Drupal data can be separated to three buckets: (1) User interface (2) Content (3) Configuration. Drupal has very extensive support for user interface translation, I'd say too much support for content translation and usually not so bright support for configuration translation. Let's enumerate what Drupal has on offer for each piece.

By Gábor Hojtsy , 17 June, 2011

As some of you might be aware, a group of talented and very determined people sprinted in Berlin about a month ago just to improve the i18n module for almost a week. A lot of great improvements made it in including tests, translatable contact forms and even some great usability improvements. Jose Reyero and Friederike Schmiedebach have great posts about the sprint.

Before continuing my article series, I wanted to touch quickly on the usability improvements, because my previous piece presented a pretty grim picture of textgroup based translation solutions such as blocks. Well, i18n module is still using that backend, but the new user interface improvements will make the translation process much more transparent and a lot easier to work with when managing Drupal configuration.

By Gábor Hojtsy , 8 June, 2011

My last post where I've explained how Internationalization module re-implements some of Field API and where it does not do that it misses crucial functionality did not get much discussion. Therefore I decided to turn the key point at the end to the center of discussion: that either Drupal core will do fields for all user input (content and configuration alike, all through form your site name to your views empty text), or i18n module needs to do it in contrib. There is a clear need for input widgets, validators, permission handling, storage and output formatters and rendering used consistently. If it is not done by core, it will keep being a bolted-on half-failing approach despite best efforts in contrib. Please discuss at http://groups.drupal.org/node/154434

The other important post that we need your input on is about removing all UI strings from code. There are various issues with having them in code, while there are also various disadvantages to removing them from there. There are performance, translatability and even user experience concerns involved. This post is already getting some discussion, but we need much more. This could be a huge, fundamental change, so all your input is welcome. Don't say we did not ask you. Please discuss at http://groups.drupal.org/node/154394

Your input helps shape Drupal 8 and how Drupal supports building multilingual sites for years to come. Have your voice heard now!

By Gábor Hojtsy , 1 June, 2011

There is great discussion forming on my previous posts on exportables and user provided text as well as the dangers of using t() for user editable data, and I can only hope we can keep that up! In that tradition, I'm cross-posting this piece to groups.drupal.org as well for discussion.

Regular readers could find this boring, but let's reiterate the three working modes that all objects should ideally be able to handle in Drupal to support multilingual site building.

  1. Being able to mark an object as in one language.
  2. Being able to mark an object as in one language and relate it to others as being a translation set. This is useful when you want to use the different language objects in different relations, track their history separately, have different permissions and workflows for them, etc.
  3. Being able to translate pieces of the object that need translation and leave the rest alone. Load the right language variant of the object dynamically as needed. This is very useful for keeping external relations intact and sharing common fields between translations effortlessly.

There are certain things, where not all of these make sense. For the site's name for example, people would probably only use either (1) or (3). For a block for example, people should be able to use either based on their needs. (2) is useful to place blocks differently on translated pages, (3) is good to keep the placement consistent without effort. This can be different on a per-block basis. Same applies to nodes, menus, taxonomy, views, rules, and so on.