3

I cannot find any good examples on how to make a module configuration translatable. Could someone give me a starter example to build off with?

1
  • You should definitely read this tutorial: hojtsy.hu/blog/2014-may-26/… . It's part of a series of tutorials for multilingual Drupal 8 development by the same author. Highly recommended. Commented Jul 9, 2017 at 9:36

1 Answer 1

1

In config there are only few field types that are translatable by default text, label and i think date_format(you can check the schema types to see which field types exactly are translatable by default). You can also make any value translatable by adding the translatable: true flag to the field. Now, copy your config/install directory into config/install/language/LANGCODE and edit each one of those config files and keep only the translatable fields..and translate those :)

If you want to provide translations for you module so t() function will pick them up, that is a bit strange in D8 compared to D7 but to put it simply you have to edit your module's info file and put in the following lines:

'interface translation project': yourprojectname 'interface translation server pattern': relativepathtotranslationsdirectory/%project-%version.%language.po 
2
  • Shouldn't the translation folder be config/install/language/LANGCODE instead? Commented Jul 8, 2017 at 10:34
  • You are correct, I have updated my answer. Commented Jul 9, 2017 at 6:15

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.