2.8. Region and language. Translation Drupal from English to another language.
Drupal has ample opportunity for translation. Let have a 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.
Let's go through all the settings in this section.
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.
Click +Add format and add a format for news. For our format we will need a date string d-m-Y
You can read more about Format string in the date () function manual.
Now we can put the output of our date for all fields of the Date type and for other date outputs.
Let's add German language.
After adding the language, Drupal 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.
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.
If you go to the German editing page:
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
Will be for the German language.
For English, but at the same time for the default language, the language code can be omitted
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:
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.
User Interface Translation
You probably already noticed that Drupal does not translate 100% of the interface:
For the remaining lines, we can use the manual translation form:
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 unloaded the .po file, which you can use on your other sites by downloading this .po file through the Import tab.
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.