Multiline strings in Gettext?

As far as I can tell there isn’t support for multiline strings in gettext.

I haven’t found any workarounds other than having multiple msgid in my po file.

Am I missing something?

For anybody who’s struggling with this, here’s how to define multiline strings with gettext:

In Elixir:

gettext("""
This is a multiline
string

with a break.\n
""")

In the PO file:

msgid ""
"This is a multiline\n"
"string\n"
"\n"
"with a break\n"
""
msgstr ""
"This is the multiline\n"
"string\n"
"\n"
"translated\n"
""
3 Likes