Mikhail Ismajlov 08/16/2019

In Drupal 8 ample opportunity for translation. Let's look at how you can add a new language to a site such as German. To do this, go to Regions and language configurations, before this, the language, Configuration Translation, Content Translation, Interface Translation modules must be installed.

Drupal 8 region and language

Let's go through all the settings in this section.

Regional settings

Drupal 8 language translation

Everything is clear here, but I think it's worth changing the first day of the week to Monday. You can also give the user the opportunity to select the time zone during registration, but you can also remove it. This is necessary when the site has time-related functionality, for example Events, the date of which is displayed for each in his own time zone.

Date and time formats

We can set our own date format through the admin panel. Quite often in the news you need to display a date in the form of day-month-year. Let's do that.

drupal 8 date and time formats

Click +Add format and add a format for news. For our format we will need a date string d-m-Y

drupal 8 format date

You can read more about Format string in the date () function manual.

http://php.net/manual/ru/function.date.php

Now we can put the output of our date for all fields of the Date type and for other date outputs.

Languages

Drupal 8 languages

Let's add German language.

drupal 8 add language

After adding the language, Drupal 8 will begin updating the translation, this requires the Internet and this will take some time.

That's all, we added a new language to the site, you can turn it on and make sure that everything works.

Drupal 8 German

We will return the English language back. If you go to the Detection and selection tab, you can choose how to determine the language on the site. It’s best to use the page URL.

drupal 8

If you go to the German editing page:

drupal 8

That there is a language code setting. This code is added to the page URL to determine for which language this page is, for example

http://site/de/node/10

Will be for the German language.

http://site/en/node/10

For English, but at the same time for the default language, the language code can be omitted

http://site/node/10

It will be the same for the English language.

Also, if you go to the edit page for the content type, for example, Articles, then you can check the box so that the language selection is available when creating a node:

/admin/structure/types/manage/article

drupal 8 languages

We can choose the language not only for nodes, but also for blocks, users, comments and other entities of our site.

Now when adding a block, we can choose for which language this block is added.

Drupal 8 translation

User Interface Translation

You probably already noticed that Drupal does not translate 100% of the interface:

Drupal 8 interface translation

For the remaining lines, we can use the manual translation form:

/admin/config/regional/translate

Drupal 8 line feed

We enter the desired phrase in English and Drupal we find all the lines with this phrase. We write the translation and click the Save translation at the bottom of the page.

And so we can translate lines throughout Drupal.

We can also transfer Drupal manually and upload our translations in the Export tab.

Drupal 8 language export

Drupal unloaded the .po file, which you can use on your other sites by downloading this .po file through the Import tab.

drupal 8 import translations

And finally, we have the Settings tab, where we can set the check for translation updates. You can put a translation check every month. Drupal will constantly show you untranslated lines, there is never 100% translation into another language. With each addition of a new module, untranslated lines appear.

drupal 8 settings