[Django] #17375: 'makemessages' ignores plural from 'blocktrans'

51 views
Skip to first unread message

Django

unread,
Dec 10, 2011, 12:05:41 PM12/10/11
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+--------------------
Reporter: ahagenbruch | Owner: nobody
Type: Bug | Status: new
Component: Internationalization | Version: SVN
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
I have two files with equal strings to translate, in the first file
with `trans` and in the second file with `blocktrans` and a plural form:

{{{
a.html:
{% trans 'My string' %}
}}}

{{{
b.html:
{% blocktrans count counter=mylist|length %}My string{% plural %}My
strings{% endblocktrans %}
}}}

and when I run `django-admin.py makemessages -l de` I get

{{{
django.po
#: templates/a.html:108
#: templates/b.html:3
msgid "My string"
msgstr ""
}}}

and not as you'd expect

{{{
django.po
#: templates/a.html:108
#: templates/b.html:3
msgid "My string"
msgid_plural "My strings"
msgstr[0] ""
msgstr[1] ""
}}}

I can reproduce this for similar structures in other files.
`blocktrans` strings that don't have `trans` equivalents in other
files correctly produce entries with plural forms in the .po file.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 10, 2011, 1:06:35 PM12/10/11
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner: nobody
Type: Bug | Status: new
Component: | Version: SVN
Internationalization | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Seems to trigger this bug: https://savannah.gnu.org/bugs/index.php?35027

One possible workaround in makemessages could be to pass a list of files
to xgettext instead of concatenating messages for each individual file, as
xgettext seems to properly handle the merge.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:1>

Django

unread,
Dec 10, 2011, 5:31:30 PM12/10/11
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: nobody
Type: Bug | Status: new
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:2>

Django

unread,
Feb 4, 2012, 9:30:05 AM2/4/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: new
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by pigletto):

* owner: nobody => pigletto
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:3>

Django

unread,
Feb 4, 2012, 2:25:29 PM2/4/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: new
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by pigletto):

* needs_tests: 1 => 0


Comment:

This issue doesn't exist anymore in current trunk (1.4).

Attached test for this specific case.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:4>

Django

unread,
Feb 4, 2012, 2:28:02 PM2/4/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by pigletto):

* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:5>

Django

unread,
Feb 4, 2012, 4:06:54 PM2/4/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by claudep):

The only reason it is working in your patch is that the msgid of the
problematic string in test.html has a msgctxt line.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:6>

Django

unread,
Feb 4, 2012, 4:31:39 PM2/4/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by pigletto):

Ok, right, it fails for blocktrans that doesn't use 'context'. Uploaded
patch solves issue as suggested by using xgettext call with multiple files
at once.

One thing to modify there yet is to make use of -f, --files-from in cmd
for xgettext, instead of passing great amount of parameters.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:7>

Django

unread,
Feb 4, 2012, 4:31:50 PM2/4/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by pigletto):

* cc: pigletto (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:8>

Django

unread,
Feb 4, 2012, 5:35:05 PM2/4/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by pigletto):

Uploaded issue_17375.2.diff that uses --files-from parameter for xgettext.
Now patch seems to be complete for me.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:9>

Django

unread,
Feb 4, 2012, 5:49:52 PM2/4/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: | Version: SVN
Internationalization | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ext):

* stage: Accepted => Ready for checkin


Comment:

Looks and works OK.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:10>

Django

unread,
Feb 9, 2012, 1:02:35 PM2/9/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: | Version: SVN
Internationalization | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by jezdez):

This doesn't apply to trunk anymore.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:11>

Django

unread,
Feb 18, 2012, 5:23:23 AM2/18/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* stage: Ready for checkin => Accepted


Comment:

Indeed, patch no longer applies.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:12>

Django

unread,
Mar 3, 2012, 4:36:21 PM3/3/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by pigletto):

OK, I'm going to update it soon

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:13>

Django

unread,
Mar 4, 2012, 5:54:37 PM3/4/12
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: Internationalization | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by pigletto):

* needs_better_patch: 1 => 0


Comment:

Patch updated

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:14>

Django

unread,
May 21, 2014, 5:12:05 AM5/21/14
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: Internationalization | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by claudep):

#22671 was a duplicate

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:15>

Django

unread,
Jun 24, 2014, 8:46:35 PM6/24/14
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
--------------------------------------+------------------------------------
Reporter: ahagenbruch | Owner: pigletto
Type: Bug | Status: assigned
Component: Internationalization | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timo):

* needs_better_patch: 0 => 1


Comment:

Patch no longer applies cleanly.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:16>

Django

unread,
Jun 6, 2015, 12:46:26 PM6/6/15
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner:
| sergeykolosov
Type: Bug | Status: assigned
Component: | Version: master
Internationalization |

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by sergeykolosov):

* cc: m17.admin@… (added)
* owner: pigletto => sergeykolosov


Comment:

Working on it.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:17>

Django

unread,
Aug 24, 2015, 7:40:34 PM8/24/15
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner:
| sergeykolosov
Type: Bug | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by sergeykolosov):

* needs_better_patch: 1 => 0


Comment:

Created a PR with another implementation based on the original idea from
Claude:
https://github.com/django/django/pull/5187

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:18>

Django

unread,
Aug 26, 2015, 7:53:52 PM8/26/15
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner:
| sergeykolosov
Type: Bug | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

Left some comments for improvement.

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:19>

Django

unread,
Aug 27, 2015, 12:18:20 PM8/27/15
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner:
| sergeykolosov
Type: Bug | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by sergeykolosov):

* needs_better_patch: 1 => 0


Comment:

PR updated: https://github.com/django/django/pull/5187

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:20>

Django

unread,
Aug 27, 2015, 1:13:09 PM8/27/15
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner:
| sergeykolosov
Type: Bug | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


Comment:

Claude, could you take a look?

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:21>

Django

unread,
Aug 28, 2015, 3:11:37 AM8/28/15
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner:
| sergeykolosov
Type: Bug | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by claudep):

Looks like a solid patch. Thanks Sergey!

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:22>

Django

unread,
Aug 28, 2015, 3:42:31 PM8/28/15
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner:
| sergeykolosov
Type: Bug | Status: closed
Component: | Version: master
Internationalization |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"e75882332c8593a1d5a47f9f1e099e9201b12296" e7588233]:
{{{
#!CommitTicketReference repository=""
revision="e75882332c8593a1d5a47f9f1e099e9201b12296"
Fixed #17375 -- Changed makemessages to use xgettext with --files-from

Changed the way makemessages invokes xgettext from one call per
translatable file to one call per locale directory (using --files-from).
This allows to avoid https://savannah.gnu.org/bugs/index.php?35027 and,
as a positive side effect, speeds up localization build.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:23>

Django

unread,
Apr 30, 2016, 6:09:34 AM4/30/16
to django-...@googlegroups.com
#17375: 'makemessages' ignores plural from 'blocktrans'
-------------------------------------+-------------------------------------
Reporter: ahagenbruch | Owner:
| sergeykolosov
Type: Bug | Status: closed
Component: | Version: master
Internationalization |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"185f90c45f4398f186ee9dffe1c9bd7392a47686" 185f90c]:
{{{
#!CommitTicketReference repository=""
revision="185f90c45f4398f186ee9dffe1c9bd7392a47686"
Adapted _assertPoLocComment for multi-file source lines in po files

Refs #17375.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/17375#comment:24>

Reply all
Reply to author
Forward
0 new messages