6

I have been trying to import my custom interface translation during profile installation using a .po file that is put inside the translations folder in my custom module. After running:

drush locale-update && drush cr

All I get is community translations which are not accurate sometimes (no translation is imported from my .po file).

How can I import translations only from my local .po file?

Thank you.

7

To import your own translations you should use the interface translation properties on your module.

I'm using a folder translations in my modules where my 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

And to update your translations use this:

drush locale-check && drush locale-update && drush cr

EDIT: To update existent translations you should take a look at the settings page (/admin/config/regional/translate/settings):

enter image description here

You can try to use local translation files only or to overwrite any existing translation.

  • 1
    Thanks, this works but not exactly what I wanted. I prefer to override the provided translations (community translations) with my own translations. – Achraf JEDAY Jan 8 '18 at 16:58
  • @AchrafJEDAY have you tested a different import behavior? I've updated my answer with some information about available interface translation settings. – RWAM Jan 9 '18 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.