Search code examples
htmltornadogettext

Tornado: HTML inside gettext function string


I am using gettext for internationalisation. I have HTML tags in one sentence, but after translation the HTML tags are shown as string.

msgid "<strong>Dokument(e)</strong> offline verfuegbar machen<br>"
msgstr "<strong> Dokument(e)</strong> offline verfügbar machen<br>"

Does someone has more experience with this?

I need this output: Dokument(e) offline verfügbar machen
but the output is: "<strong> Dokument(e)</strong> offline verfügbar machen<br>"


Solution

  • If your strings contain html, you must use a raw template expresssion. Use {% raw _("my string") %} instead of {{ _("my string") }}.