#18114: makemessages does not care about context in trans templatetag --------------------------------+------------------------------------- Reporter: tomaz.stucin@… | Owner: nobody Type: Bug | Status: new Component: Translations | Version: 1.4 Severity: Normal | Keywords: trans context, pgettext Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------+------------------------------------- We are working with translations and we have done the following * we have 2 templates: template1.html and template2.html * in template1 we have the following: {{{ {trans 'contact' as trans_contact %} }}} * in template2 we have the following: {{{ {trans 'contact' context 'suggestive' as trans_contact %} }}} * when we makemessages -a we get the following in the django.po file: {{{ #: web/templates/web/template1.html:35 #: web/templates/web/template2.html:21 msgid "contact" msgstr "" }}} - what we expect instead (in django.po) is actually: {{{ #: web/templates/web/template1.html:35 msgid "contact" msgstr "" #: web/templates/web/template2.html:21 msgctxt "suggesttive" msgid "contact" msgstr "" }}}
So it seems that the "django-admin.py makemessages -a" does not take into account context in the trans templatetag (but it does process both trans tag as can be seen in the comment) If we write (anywhere in the code) the following: {{{ from django.utils.translation import pgettext test = pgettext('suggesttive', 'contact') }}} then the django.po content is as expected and if we translate the strings (in django.po) and then render the template, the context is taken into account and the translation on the webpage (produced from the template) is as it should be, so the trans templatetag works as expected, just the makemessages does not. If this is a "feature" I apologize in advance. -- Ticket URL: <https://code.djangoproject.com/ticket/18114> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.