Site icon Hip-Hop Website Design and Development

Mobilefish.de: Import translations on profile or module installation

Import translations on profile or plugin installation
Peter Majmesku
Fri, 06/01/2020 – 23:11

Let’s say you have a custom plugin 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 plugin is installed.

Use a folder named translations inside the plugin 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_plugin.info.yml:

‘interface translation project’: example_plugin
‘interface translation server pattern’: plugins/custom/example_plugin/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
WordPress maintenance support plans 8
WordPress maintenance support plans Planet
WordPress maintenance support plans

Add new comment

Source: New feed