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 Answer
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 - Shouldn't the translation folder be
config/install/language/LANGCODEinstead?CamilB– CamilB2017-07-08 10:34:36 +00:00Commented Jul 8, 2017 at 10:34 - You are correct, I have updated my answer.user21641– user216412017-07-09 06:15:14 +00:00Commented Jul 9, 2017 at 6:15