bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch for xgettext non-reorderable format string warning regression


From: Bruno Haible
Subject: Re: Patch for xgettext non-reorderable format string warning regression in v0.21
Date: Fri, 18 Oct 2024 01:21:38 +0200

Hi,

Max Smolens wrote in
<https://lists.gnu.org/archive/html/bug-gettext/2020-10/msg00001.html>:
> Attached is a patch for a bug where the non-reorderable format string
> warning is not displayed. This is a regression in v0.21 introduced by
> commit d079c75.
> 
> For example, with the following example file code_sample.py:
> 
>     from django.utils.translation import gettext
> 
>     # This will generate an xgettext warning
>     my_string = gettext("This string contain two placeholders: %s and %s" %
> ('a', 'b'))
> 
> v0.20.2 displays the following warning:
> 
>     $ xgettext --language=Python ./code_sample.py
>     ./code_sample.py:4: warning: 'msgid' format string with unnamed
> arguments cannot be properly localized:
>                                  The translator cannot reorder the
> arguments.
>                                  Please consider using a format string with
> named arguments,
>                                  and a mapping instead of a tuple for the
> arguments.
> 
> But v0.21 does not.

Thanks a lot for the report, the analysis, and the fix!

The bug already happens to be fixed in the git tree, since
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=1a110e6184d7a208b5797e855eccb4aa79e72b88

Nevertheless, I'm adding a unit test:
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=c31a5e4e90cb52c0b168f3cab9ac7f94c87df945

Thanks again!

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]