3

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>')

1 Answer 1

3

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...

Sign up to request clarification or add additional context in comments.

9 Comments

the problem is, that it actually filters my html tags. So the msgid is msgid "My long text that I because I need to"
What do you use for extracting messages? We use standard xgettext at phpMyAdmin and it keeps html correctly
We use PoEdit for Mac and i'm still searching why HTML gets ripped
And what do you use for extracting messages from PHP files?
You can try running xgettext manually if that differs from what you get inside PoEdit.
|

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.