Re: problem with plural-forms - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: problem with plural-forms
Date
Msg-id 200905261339.08519.peter_e@gmx.net
Whole thread Raw
In response to problem with plural-forms  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
Responses Re: problem with plural-forms  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
Re: problem with plural-forms  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: problem with plural-forms  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
List pgsql-hackers
On Monday 25 May 2009 19:11:24 Zdenek Kotala wrote:
> I tried to run msgfmt -v ... on solaris and I got following error:
>
> Processing file "psql-cs.po"...
> GNU PO file found.
> Generating the MO file in the GNU MO format.
> Processing file "psql-cs.po"...
> Lines 1311, 1312 (psql-cs.po): incompatible printf-format.
>      0 format specifier(s) in "msgid", but 1 format specifier(s) in
> "msgstr". ...
> ...
>
> Problem is in:
>
> #: print.c:2351
> #, c-format
> msgid "(1 row)"
> msgid_plural "(%lu rows)"
> msgstr[0] "(%lu řádka)"
> msgstr[1] "(%lu řádky)"
> msgstr[2] "(%lu řádek)"
>
>
> The problem here is (1 row) instead of (%lu row). When I run msgfmt
> without -v everything works fine but I think we should fixed it (there
> are more occurrences of this issue).

GNU gettext accepts this, and in fact the GNU gettext documentation explicitly
points out that this allowed:

"""    In the English singular case, the number - always 1 - can be    replaced with "one":
         printf (ngettext ("One file removed", "%d files removed", n), n);
    This works because the `printf' function discards excess arguments    that are not consumed by the format string.
"""

One might consider this better style (English style, not C style) in some
contexts.

Of course the concrete example that you show doesn't actually take advantage
of this, so if it is important to you, please send a patch to fix it.


pgsql-hackers by date:

Previous
From: Tatsuhito Kasahara
Date:
Subject: Re: patch for ja.po
Next
From: Peter Eisentraut
Date:
Subject: Re: A couple of gripes about the gettext plurals patch