Drupal 8 multilingual tidbits 9: deployment friendly automated downloads

Up to date as of October 16th, 2015.

Let's move on to improvements around the interface (shipped software) translation solutions in Drupal 8! The new version separates the responsibilities for the base language layer (Language module) from the software's translation (Interface Translation module), and largely expands on the features of the interface translation capability.

Automated translation downloads

The biggest pain in setting up Drupal for a foreign language or especially multiple foreign languages is downloading and importing all the translation files. If you have Drupal core and 50 modules and want to have your site in 3 languages, you need to manually identify the version numbers and project shortnames for the 50 projects and download translations for all three languages. 153 files in total (core included). Then all these files sitting on your desktop, you need to upload them through the web interface one by one to get them all imported to the Drupal database.

Of course this is very painful, so we built the Localization update module to automate it. It was a very logical next step to build this into Drupal 8!

So the new Drupal version makes use of this functionality from the first installer step. As we covered in the first tidbit, the installer starts off with a language selector and will automatically download the right translation file before the next screen shows up (if an internet connection is available).

This functionality is future-proof and works with any distribution. Once Drupal is installed, the translation update runs once more in the installer, so if any contributed modules were included in the distribution, those translations are also imported. All modules and themes installed later get the same treatment. (We also eliminated configuration initialisation issues when architecting the new configuration translation system, so it does not matter anymore whether we import module translations before or after the module is installed.)

Automated updates from the community

The community is busy working on translations all the time. Modules and themes you use may have updated translations later. Drupal 8 also has built in features to update translations later from the community. You can configure to update weekly, monthly or never. The updates are also pre-configured to protect your local customisations, read more about that in an upcoming tidbit!

Staging and deployment friendly features

Although translations are stored and used from the database, the translation download and update feature now uses one central directory to store all the files retrieved. This allows for staging or dev environments to have translation updates enabled before quality assurance happens, and live environments to have it disabled, so drush commands doing the deployment can do the import from the pre-configured directory. This directory can also be put into version control allowing you to track each change to the live interface translations.

Issues to work on

  1. DONE! The automated download functionality currently defaults to downloading 7.x translations in the installer. This is due to a prior state of translations, when Drupal 8 .po files were not available for download. Since Drupal 8.0 alpha 2, these are available, but the code does not yet find them. We need to update some rules. Also, those fallback rules are not yet used when adding a new language, so new translation files are not actually downloaded when adding new languages. These can be resolved. See http://drupal.org/node/2030537 and https://drupal.org/node/1914070
  2. MOSTLY DONE: Localize.drupal.org does not yet fully support all the new APIs in Drupal 8, so the new version is not entirely translatable yet. See details at https://localize.drupal.org/node/5853
  3. Drush still needs to catch up to have commands exposing the translation file update and download features, so it can be effectively used in deployment. See https://github.com/drush-ops/drush/issues/139 for the related issue.

Add new comment