{{{
======================================================================
FAIL: test_extraction_warning (i18n.test_extraction.BasicExtractorTests)
test xgettext warning about multiple bare interpolation placeholders
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
yield
File "/usr/lib/python3.9/unittest/case.py", line 593, in run
self._callTestMethod(testMethod)
File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
method()
File "/tmp/django/tests/i18n/test_extraction.py", line 233, in
test_extraction_warning
self.assertIn("code_sample.py:4", out.getvalue())
File "/usr/lib/python3.9/unittest/case.py", line 1098, in assertIn
self.fail(self._formatMessage(msg, standardMsg))
File "/usr/lib/python3.9/unittest/case.py", line 670, in fail
raise self.failureException(msg)
AssertionError: 'code_sample.py:4' not found in 'processing locale de\n'
}}}
I can reproduce the failure with django 2.2.15, 3.0.9 and git master
(b68b8cb89abb35ff2152175ea540619ec384b1f4).
--
Ticket URL: <https://code.djangoproject.com/ticket/31850>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Bug => Cleanup/optimization
* component: Uncategorized => Testing framework
* easy: 0 => 1
* stage: Unreviewed => Accepted
Comment:
I confirmed test failure with `xgettext` 0.21, it passes with the version
`0.19.8.1`. We can skip this test on specific versions of `xgettext`. Do
you know when exactly it stopped to warn about multiple bare placeholders?
Changelog would be helpful.
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:1>
Comment (by felixxm):
We should use a message that will cause a `xgettext` warning in all
versions, see #18479.
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:2>
* owner: nobody => Sicong
* status: new => assigned
Comment:
I'll try to work on this issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:3>
* owner: Sicong => (none)
* status: assigned => new
Comment:
I can also reproduce this error.
I looked a little bit into gettext's source code, under
`warn_format_string` function in `xg-message.c`. Everything seems fine.
I'm not sure why `xgettext` not giving this warning. I'll leave this to
somebody with more experience.
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:4>
* owner: (none) => stackaccount1
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:5>
Comment (by Ira):
Can someone above help me reproduce the error? Please let me know
ira...@gmail.com
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:6>
* owner: (none) => Max Smolens
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:8>
* has_patch: 0 => 1
Comment:
It looks like xgettext 0.21 has a bug where the "format string with
unnamed arguments cannot be properly localized" warning is not displayed.
I proposed a patch upstream and am awaiting confirmation from the
maintainer.
Regardless, I created a patch to use a message that causes an xgettext
warning in all versions, as suggested by comment:2.
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:9>
Comment (by Michał Górny):
Would it be possible to backport this into 2.2, 3.0 and 3.1 branches?
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:13>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"e707a1bd9a485319421414f2d171c3faca9cd58c" e707a1bd]:
{{{
#!CommitTicketReference repository=""
revision="e707a1bd9a485319421414f2d171c3faca9cd58c"
[3.1.x] Fixed #31850 -- Fixed BasicExtractorTests.test_extraction_warning
with xgettext 0.21+.
"format string with unnamed arguments cannot be properly localized"
warning is not raised in xgettext 0.21+.
This patch uses a message that causes an xgettext warning regardless of
the version.
Backport of 07a30f561661efae1691ff45d10ec6014b395b58 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:14>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"c506639b425ca876b2d9a633fc6410e917d45605" c506639b]:
{{{
#!CommitTicketReference repository=""
revision="c506639b425ca876b2d9a633fc6410e917d45605"
[3.0.x] Fixed #31850 -- Fixed BasicExtractorTests.test_extraction_warning
with xgettext 0.21+.
"format string with unnamed arguments cannot be properly localized"
warning is not raised in xgettext 0.21+.
This patch uses a message that causes an xgettext warning regardless of
the version.
Backport of 07a30f561661efae1691ff45d10ec6014b395b58 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:15>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"e893c0ad8b0b5b0a1e5be3345c287044868effc4" e893c0ad]:
{{{
#!CommitTicketReference repository=""
revision="e893c0ad8b0b5b0a1e5be3345c287044868effc4"
[2.2.x] Fixed #31850 -- Fixed BasicExtractorTests.test_extraction_warning
with xgettext 0.21+.
"format string with unnamed arguments cannot be properly localized"
warning is not raised in xgettext 0.21+.
This patch uses a message that causes an xgettext warning regardless of
the version.
Backport of 07a30f561661efae1691ff45d10ec6014b395b58 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:16>
Comment (by Mariusz Felisiak):
Replying to [comment:13 Michał Górny]:
> Would it be possible to backport this into 2.2, 3.0 and 3.1 branches?
Backported.
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:17>
Comment (by Michał Górny):
That was fast. Thank you!
--
Ticket URL: <https://code.djangoproject.com/ticket/31850#comment:18>