I have built a simple module that contains several modules. Each shows a page with some descriptive text, a form and a result table. The result table is populated using the input and some calculations in javascript. The form works as expected.

The descriptive text is in English but my site is multilingual so I have added Dutch translations as well. The translations of single words or short sentences works fine, but longer text (e.g. three lines of text in a

) doesn't translate at all even if the English text and the translation is in a nl.po file, alongside of the shorter text.

It worked once, but now I don't seem to get it to work again. I did notice that the correct number of whitespace is vital, but I cannot find what to do to get it to work.

For clarification purposes, this works:

msgid "Calculate"
msgstr "Berekenen"

msgid "Have fun!"
msgstr "Veel plezier!"

So on the Dutch version I see 'Berekenen' and 'Veel plezier!'

This doesn't work:

msgid ""
"The units of the sizes are equal to the number you enter, i.e. if you "
"enter the size in inches, the\n"
"        calculated sizes are also in "
msgstr ""
"De eenheden zijn gelijk aan de eenheid die u invoert, m.a.w. als u centimeters invoert, zijn de\n"
"  berekende maten ook in centimeters."

This is displayed as English on the Dutch page.

What do I need to do to make this work again?

And is there a more finegrained way than simply exporting everything to work with multilingual content in custom modules?

  • Both your message id and message string are set to empty values in the second example. Also, you've got the strings broken up into multiple strings, instead of a single string. – Jaypan Feb 8 at 15:55
  • according to the specs that is the way it is supposed to work for longer strings and it used to work in a different theme and earlier Drupal 8 version – hepabolu Feb 9 at 17:40
  • So making the changes I suggested didn't work? – Jaypan Feb 9 at 18:00
  • just to be sure, I tried again, but sorry no, that doesn't help. – hepabolu Feb 9 at 18:59

Your Answer

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

Browse other questions tagged or ask your own question.