spankmaster79
spankmaster79

Reputation: 22203

PHP: HTML inside gettext function string

I'm somewhat of confused. As far as I knew every text in a gettext function is used as msgid

So this one:

_("My long text that I <br> because I need to ")

should be:

#: htdocs/index.php:8
msgid "My long text that I <br> because I need to"
msgstr "Translation needs different <br> inside because russian is different"

I just can't find any documentation that gettext() or _() strips html tags out.

Should I be replacing it like this? And why?

sprintf(_("My long text that I %s because I need to "), '<br>')

Upvotes: 3

Views: 3804

Answers (1)

Michal Čihař
Michal Čihař

Reputation: 10091

Both would work okay, gettext does not string anything out of the messags. You might however want to not include HTML in translations to make translators life easier - it is easier to just translate string and don't have to care about HTML markup. Of course sometimes it is not really possible...

Upvotes: 3

Related Questions