0

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 <p>) doesn't translate at all even if the English text and the translation is in a nl.po file, alongside 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 "
"inches."
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?

4
  • 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
    Commented Feb 8, 2020 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
    Commented Feb 9, 2020 at 17:40
  • So making the changes I suggested didn't work?
    – Jaypan
    Commented Feb 9, 2020 at 18:00
  • just to be sure, I tried again, but sorry no, that doesn't help.
    – hepabolu
    Commented Feb 9, 2020 at 18:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.