Import translations on profile or module installation
Peter Majmesku
Fri, 06/01/2020 – 23:11
Let’s say you have a custom module and you want to attach translation files to it. You want to import the translation files after installation or after you have updated the .po translation files. Also make sure that the Interface Translation (locale) core module is installed.
Use a folder named translations inside the module where the language files like de.po or fr.po can be found. To load the translations you have to insert the following lines into your example_module.info.yml:
‘interface translation project’: example_module
‘interface translation server pattern’: modules/custom/example_module/translations/%language.po
Note: more details about the interface translation properties can be found here.
To update your translations use the following Drush commands:
drush locale-check && drush locale-update && drush cr
To update existent translations you should take a look at the settings page (/admin/config/regional/translate/settings). You can use local translation files only or overwrite any existing translation.
Tags
Drupal maintenance support plans 8
Drupal maintenance support plans Planet
Drupal maintenance support plans
Add new comment
Source: New feed