multilingual

By Gábor Hojtsy , 19 May, 2014

Up to date as of October 29th, 2015.

After a long 8 months break in the article series, we are back to talk about configuration translation basics. Why the long break? Well, both the configuration and content system was in heavy development with changes and I did not want to get you content that would be quickly outdated. In the meantime Alex Pott also posted a great set of articles titled Principles of Configuration Management Part 1 and Part 2 which serves as great introductions. We’ll cover configuration translation first because that is more baked.

The Drupal 8 configuration system is a boon for language

As I wrote in the previous article in the series, configuration is now encompassing lots of settings that were variables or used custom settings storage in Drupal 7. The biggest value for non-English and multilingual sites in Drupal 8 of the configuration changes is that now a common system is used to manage your site name, email text settings through to views, field settings, entity form displays, etc. We can introduce language and translation support in a way that modules will need to plan with. It is not just an optional contributed add-on but a core feature.

By Gábor Hojtsy , 7 May, 2014

Drupal is right in the middle of web technology, an ideal integrator of all kinds of things. Just like PHP itself it may be clunky here and there but it is a very efficient tool to build great experiences. And even if you are a great JS developer or a pro PHP person, maybe you have mad debugging skills, you always have something to learn. Now there are great books, sometimes even better videos, but nothing beats hands-on learning. When you get together with other people working on the same thing you learn so much about how they work and even if you gain no new knowledge about programming per say, you learn new tricks and ways to achieve things:

Not only that but you can also look into how the tools you work with are made and that all of us are human:

Finally, by helping to improve the tools you use, you gain much better knowledge about them. Close to the start of my web involvement I worked a lot on translating the PHP documentation to Hungarian and I got into Drupal fixing core issues for translations. By becoming one of the thousands building the system you use you also gain more credibility when you are looking for help in your weak areas as well:

But not everyone can do this right? You need to be a professional programmer and pay expensive fees to get into events? Wrong! So wrong! There are always sprints around the globe and more and more local Drupal events are announced every day. Starting out with a simple issue on a one day sprint is a great start. Drupal can always be improved in all kinds of ways whether that is accessibility testing, documentation, perfecting button colors and radiuses or finding and documenting bugs. All of those are great contributions.

Image


Drupal Dev Days sprint photo by Amazee Labs

The best places to immerse yourself in contribution are multi-day sprints though. If you have any opportunity to go to those, I would definitely suggest you join one. Why? It takes a fair bit of time to get set up, understand the issue, start providing a solution and even though at the end of the one day sprint, you will promise to get back to it a week later from home, it is almost certainly not going to happen. There is nothing wrong with you, you just have other priorities when you get out of sprint-mode. So for ideal involvement pick a multi-day sprint. It is not only that you have more time to work on things, you can get to know the people better as well on the social events. Some conferences, especially DrupalCons include extended sprints before/after the event. If you just go to the main conference days, you have much less chance to interact with people who shape the future of Drupal, while at the extended sprints, you can get involved and work with them real time. How is that for growing your potential?

Here are some examples of events with multi-day sprints where my friends from the multilingual initiative will be sprinting, feel free to add more in the comments:

DrupalCamp Spain in Valencia is coming up in a little over a week on May 16-18th. All three days have sprinting opportunities and some of the leaders from multilingual, frontend and migrations will be there!

Some people may only be aware of the Friday sprint at DrupalCons. Get a lot more out of the event by being involved with the pre and post sprints as well. DrupalCon Austin sprints last from as early as May 30 to as late as June 8th. Likewise DrupalCon Amsterdam sprints will be on from the 27th of September to as late as 5th of October. But DrupalCons are expensive, no? Well, there is no ticket needed to attend on the days when there is only sprinting, that is the pre/post sprint days and the Friday sprint. So if you join at the end, there is 3 days of consecutive working with the Drupal community for no charge where the people you interact with have no conflicting schedules to do or see sessions. How is that for hands-on experience?

Hope to see you at one of these events and other sprints in 2014 and onwards! Learn Drupal by getting involved, it is for the benefit of us all!

By Gábor Hojtsy , 13 April, 2014

Did you expect to see how Drupal 8 improves multilingual tasks at NYC Camp? Well, bad luck! I'd like to apologise in place of the NYC Camp team for their messing up the schedule yesterday and their lack of communication following. I was told to set up for my presentation in a room that was not even meant to be a presentation room, let alone my presentation room, even though it was confirmed by several volunteers coming to the room. Later on yesterday, several people asked me why I did not show up for my session. I did.

The good news is that I delivered this talk before, and although the latest recorded copy is definitely not as up to date as the one I worked on for NYC Camp, you can watch it here (fast forward to 12:04 to the start of the presentation itself):

I would have loved to talk to you, bring you all the good news, answer your questions and hopefully inspire you to join our efforts. I did not get a chance this time. Hope to catch up with you sometime later at other events!

By Gábor Hojtsy , 21 February, 2014

We are heading towards the first Drupal 8 beta and there are several opportunities to help fix your pet peeves, help round out the Drupal 8 Multilingual features and just explore what is there and find and reproduce bugs if you are not that deep into development even. The following events host sprints where well known names of some of the Drupal 8 Multilingual team will be present. Meet and join us there to help get Drupal 8 to release sooner!

By Gábor Hojtsy , 28 October, 2013

Drupal 8 is coming up! Check out https://drupal.org/drupal-8.0 for all the goodness that is coming! While on the surface, a freshly installed Drupal 8 does not look all that different than Drupal 7 (the backend looks and the menus are similar), the underlying system is way more powerful and flexible. We turned flexibility up a notch in countless areas.

How best to get to know this new version? Well, there are blog posts and videos plenty as we get closer to Drupal 8 being more stable. I am writing an article series on multilingual improvements myself. We do know that some people learn great on a focused day of training though, so some of us decided to offer community training (read: really cheap!) before DrupalCamp Vienna on several Drupal 8 topics.

Along many other great trainings, on November 21st 2013, I'm doing an all day hands-on with Drupal 8's multilingual system including site building and some coding as well.

I'm really looking forward this training because I have seven years of experience commercially training people on HTML, Perl, PHP, XML, XSLT, Drupal, etc. and really love the work that is going into assembling materials and setting up a coherent system to teach capabilities and possibilities. I am also looking for this opportunity to find more Drupal 8 bugs (which I will both in preparation and we will as part of the training, I'm sure - Drupal 8 is not yet ready after all). This is a great opportunity to do some deep-dives into what changed in Drupal 8 and learn the new best practices.

I did presentations about Drupal 8 multilingual improvements at various camps and DrupalCons and the feedback was amazing. Someone wrote in Prague: Good session, maybe it would need a little bit more time or limit the content. Presentator felt little overconfident, but that may be just me. He certainly knows what he is talking about.. I cannot help the strong confidence, as I really think Drupal 8 is going to rock your socks off in terms of multilingual improvements. But this is the opportunity to have plenty time to explore all the changes and get to know in a way you would not have a chance for a long while at least.

Sign up for the training at https://2013.drupalcamp.at/trainings/tickets, it is just 50 EUR. See you there!

By Gábor Hojtsy , 11 October, 2013

As people say, the best way to learn is by doing! Did you ever want to have a better multilingual solution in Drupal? Well, Drupal 8 is a big chance. While not everything will be perfect, it will be worlds apart from Drupal 7 in all the good ways. To quote some feedback from DrupalCon Prague: The work you have done for translations is a 'game changer' for the future of Drupal. and Can't wait to be able to use it on production!

The best way to get started is to help fix the remaining issues! You not only get to have your hands on the new features in Drupal 8 and learn the intricacies of them, but also get mentorship on how to build with them and also help Drupal 8 get out sooner and be a better solution. We also have a lot of fun! Full of win!

To join in-person sprints, we have some options for you in the upcoming two months:

If you cannot make it to the in-person sprints, we are congregating in the #drupal-i18n IRC channel and have a meeting there every other Wednesday. See meeting dates/times on the front page of http://www.drupal8multilingual.org/.

By Gábor Hojtsy , 28 September, 2013

I just presented a fully up to date version of my multilingual Drupal 8 talk this week at DrupalCon Prague to a packed audience of people sitting even on the floor to learn what is coming in Drupal 8. To quote one of the feedback posts I got: Great presentation of all the beautiful work that has been done for making multilanguage easier and more flexible in Drupal 8. Can't wait to be able to use it on production! Watch this talk to figure out why!

By Gábor Hojtsy , 17 September, 2013

DrupalCon Prague is in the middle of Europe, so it is just natural that there are lots of multilingal content at this event. The following is a run-down of where you may want to go to get information, ask questions and even better: get involved!

Get all the information

  • Translation management (Thu, 1-2pm) by Michael Schmid and Cristophe Galli explores the tmgmt module suite for workflows and third party integration for translations.
  • Multilingual site tools in Drupal 8 (Tue, 1-2pm) is my session about the work done by 800+ contributors to make Drupal 8 step up several levels in multilingual support. Come to explore all the ways Drupal 8 is going to make your life much easier!

Ask all your questions

  • Creating a multilingual site (Thu 10:45-11:45am) is a BoF organized by the fine people at Lingotek where you can see their integrated translation solutions in action on Drupal 7.
  • Translation management tool deep dive (Thu 14:15-15:15) is a BoF to go hands-on with tmgmt and ask all the questions that did not fit into the session.
  • Find me at the Acquia booth on Tuesday from 2-4pm to talk about multilingual, Drupal 8 and many other things I do or Acquia does.

I usually organise a "Multilingual therapy" BoF to bring your pains and doubts, and just answer all random questions. With so much BoF coverage I think you'll find your answers. If not, I'll try my best to be there at these BoFs anyway, so we can get things sorted there too.

Work with us and get the best hands-on help

Did you ever want to have someone be able to step in and help you when learning a new system? Well, we need people to help make Drupal 8 rock and you will enjoy exploring and getting first hand help from us. Deal?

Thanks to sponsorship by Capgemini and others, we'll work from the Saturday before DrupalCon to the Sunday after to further Drupal 8's multilingual features. We already resolved almost 500 issues and gotten a long way from Drupal 7 to improve multilingual experiences for all users, but there are more things to work on still!

If you can still join us there, we'd love if you could sign up, so we know you are coming.

Looking forward to seeing all you in Prague!

By Gábor Hojtsy , 13 September, 2013

Up to date as of October 16th, 2015.

The first eight parts of this extensive series explained several great improvements in the base language system in Drupal 8, then we had five articles explaining all the great new software translation features. We are far from done yet! We still have two major categories of improvements to cover, namely content and configuration language and translation. Before we move on to the details, I wanted to post an introduction because there are very similar motivations and guiding principles around the improvements we made and this is going to make your life way easier compared to Drupal 7!

The glue module maze in Drupal 7

Drupal core in Drupal 7 provides translation capabilities for nodes, but no other content or configuration. Want to translate your blocks or taxonomy terms or menus? No luck. Unfortunately the base system does not understand or support multilingual content and configuration for these, so the rest of the modules cannot depend on that or know what to assume.

In Drupal 7 taxonomy terms are entities, but you have two choices to translate them. Either use the entity_translation contributed module (and the title module) or the i18n module suite. Both attempt to augment the system from the outside to apply their translation scheme on taxonomy terms, and other modules are not really aware of this. Display caching or taxonomy term lookup or autocomplete would not be naturally aware that there may be language concerns involved.

In Drupal 7 menus or blocks are not even entities, so they map to the generic i18n_string service provided by i18n module with their own respective mapping modules (i18n_menu and i18n_block).

Site settings like your site name or user account emails are not exempt from the need for glue modules. The variable suite of base modules are needed to provide the generic API that i18n_variable module will use to provide translation for these variables.

Once you get into contrib land, eg. translating views or webforms, yet more glue modules are needed. For Views, you need i18nviews, for webform, you need webform_localization (note the lack of consistent naming scheme).

These modules provide different levels of integrations and varying user interfaces to support your translation needs. The combination of the original modules as well as i18n, title and variable and the glue modules for each contrib module to make them work with this system ends up in a pretty sizable solution. It works in the end, but this is not what we aim for in Drupal 8.

Drupal 8 has general base solutions in core

Instead in Drupal 8 the configuration and content system is (almost) all encompassing, so you mostly either work with a configuration (entity) or a content (entity). Content entities all have fields. They at least have base fields, but most support configurable fields, so you can customize fields on blocks or taxonomy terms. Both base fields and configurable fields come with native support for multilingual storage, editing and rendering. When you deal with a node or custom block, you can equally have the fields set translatable.

This was made possible by the incredible effort of the configuration management initiative to get a generic configuration system in core and apply it to almost everything that cannot be considered content combined with the huge work of the entity system maintainers and application of the content entity system to much wider systems in core.

When common base systems are used, we don't need specialized mapper modules (and a separate system to map to) to maintain translation information and even contributed modules will be aware of the possibility of language variance and how to deal with it. The common base systems are also great when you need to write code against contact categories or block placements, you can use the same APIs and expect identical behavior.

Best of all, contributed modules applying the same base systems will not stand alone, they would use best practices built in core and work automatically with translations for configuration and content. No need for specialized systems and glue modules!

The extent of multilingual support for content and config

You'll read a lot more about these details in later tidbits. If you don't understand these, that is normal, just wanted to give a quick summary and heads up for what is coming.

The configuration system has full support for multilingual override values, so all elements stored in configuration may have language variants. There is also a contextual access system for configuration, so you can load values with specific language overrides, etc. These overrides are stored with the configuration and are fully deployment friendly as well. Default (shipped) configuration is translatable with the interface/software translation system. Such as shipped Views, content types, fields, etc. This works for all your in-house modules as well as contributed modules. Finally, there is a configuration translation user interface in core that provides a translation user interface almost fully automatically for your configuration (given the developer provided configuration schemas). Just covering these details will take up several tidbits so hold on for the details!

The content entity system also became really impressive. With several elements converted to content entities (menu items, contact forms, custom blocks, etc.) and fieldability available almost universally, storing multilingual content with content entities is natural. Fields provide native multilingual storage and core has a new content translation module that serves a user interface for this functionality applying to all content entity types.

So what is content and configuration then?

I made the following figure to illustrate how the entity system as well as configuration and content relate.

Image

Basically in Drupal 8, there are some configuration elements that are global, but most that you will encounter are itemized and therefore use the configuration entity system. Then almost everything else is based off of the content system. The good news is multilingual coverage is going to be fully available for all of the configuration pieces and content elements. So long as your contributed module or custom code is outside of these APIs, you'll be on your own for multilingual coverage. (Core has path aliases for example which have a custom implementation, but that retains multilingual coverage as a custom implementation.)

Embrace the improvements

For your multilingual needs, the emergence of a generally used entity/field system and a unified configuration system are a bliss. To build new code against these will require less learning and more widely accessible knowledge, and to support foreign language and multilingual sites will be natural due to the base systems doing the heavy lifting. This is just not possible with Drupal 7 however hard we try.

Read on with the upcoming tidbits for more details and insights!

By Gábor Hojtsy , 20 August, 2013

Up to date as of October 16th, 2015.

Although the basic underlying building block of the interface translation system in Drupal 8 that is used to translate the software itself uses the same concepts as in Drupal 7 and before, most user facing features changed. We covered how it downloads translations automatically now from the community and how you can deviate from the source with customised translations as needed. We also discussed how English can be a translation target as well. We did not yet look at the user interface to actually make these customisations on your site, but you can bet that was improved a great deal too!

In Drupal 7 and before, the built-in user interface to translate Drupal is pretty awkward. First you need to go through an intermediary page that shows you the list of languages with their status, then the translation page itself is a filtered list with source strings and status information.

Image

You cannot actually translate anything on this screen, you need to go in and edit translations for particular strings one by one. Then you get a list of big textareas for each language. If your target language is down on the page, you need to scroll down so much you cannot see the source string anymore.

Image

We believe this model of translating one string to multiple languages at once is not very realistic. The more common workflow instead is for one translator to go through multiple strings for one language.

So what did we do in Drupal 8 about this? First of all, we removed the intermediary page. If you are interested in translation status for your software translations, that is now built into the main language list table (screenshot in previous tidbit). The separate intermediary page is gone. Second, we made the source string table much more useful by making the target string editable for one specific language on the form. This makes us loose the overview of which languages each string is translated to, but is way quicker for the actual translation job. Finally, we also integrated singular/plural translation support (and this of course works with languages with any number of plural variants as well). In Drupal 7, the translation interface cannot even display the singular/plural pairings due to how the data is stored in the database.

Image

In summary, we cut out two unnecessary steps and brought in a very quick translation experience instead which even shows you which translations you changed as you go along (depicted with asterisk and yellow colouring). If you did not even know about this translation user interface in Drupal 7, there is a very good chance that was due to how hard it was to use. Drupal 8 gets you a much better solution in core! And finally, with good Drupal 8 tradition this administration interface is also responsive (adapts to varying screen sizes, even small mobile screens) and is also accessible.

Issues to work on

  • All strings entered on this user interface are now recorded as customised translations. Maybe you want to fix missing strings in community translations without needing to protect those additions from possibly better updates from the community later. Discuss this in https://drupal.org/node/2069867