Search code examples
pythondjangotranslationgettext

pgettext not showing the untranslated value in django admin


I have a model field:

title = models.CharField(pgettext_lazy('context', 'title'), max_length=255)

When I use ugettext_lazy it displays the untranslated string. (in this case 'title')

But with pgettext_lazy it becomes an empty string. (it hides the title label in the admin)

Is this standard behaviour of pgettext? Am I missing something?

.po file contents:

msgctxt "context"
msgid "title"
msgstr ""

admin looks like this http://cl.ly/072o1x3p11161X3x3y2c


Solution

  • This is the solution:

    pgettext_lazy(u'context', u'title')