0xDr0id
0xDr0id

Reputation: 319

Django translation {% trans '...' %} works but {% blocktrans %} does not work

I am currently trying to translate my website and somehow I am not able to get {% blocktrans %} to work.

<html lang="en">
<p>
    {% blocktrans with USERNAME=worker.username MANAGER=manager.username%}
        LOGIN_INFORMATION_FOR_USER_HAVE_BEEN_RESET_BY_MANAGER
    {% endblocktrans %}
</p>

<p>{% trans 'YOUR_NEW_CREDENTIALS' %}:</p>
</html>

The .po file looks as follows

msgid "LOGIN_INFORMATION_FOR_USER_HAVE_BEEN_RESET_BY_MANAGER"
msgstr "The login information for %(USERNAME)s have been reset by %(MANAGER)s."

msgid "YOUR_NEW_CREDENTIALS"
msgstr "Your new credentials"

And all of this results in this:

enter image description here

What am I doing wrong here?

Upvotes: 1

Views: 358

Answers (1)

0xDr0id
0xDr0id

Reputation: 319

I solved this issue by using the variable placeholder %(USERNAME)s in the msgid. Then, blocktrans worked as expected.

Upvotes: 1

Related Questions