Re: [HACKERS] problem with plural-forms

2009-05-27 Thread Peter Eisentraut
On Wednesday 27 May 2009 23:02:19 Zdenek Kotala wrote: > Peter Eisentraut píše v út 26. 05. 2009 v 13:39 +0300: > > 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. > > Fix attached. I found on

Re: [HACKERS] problem with plural-forms

2009-05-27 Thread Zdenek Kotala
Here is output of: for FILE in `find . -name *.po`;do LC_ALL=C msgfmt -v -o /dev/null $FILE 2>> msgfmt.txt; done Zdenek Peter Eisentraut píše v st 27. 05. 2009 v 23:08 +0300: > On Monday 25 May 2009 19:11:24 Zdenek Kotala wrote: > > The problem here is (1 row) instead of (%lu row). When

Re: [HACKERS] problem with plural-forms

2009-05-27 Thread Peter Eisentraut
On Monday 25 May 2009 19:11:24 Zdenek Kotala wrote: > 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). I don't think we can find all these occurrences without the Sola

Re: [HACKERS] problem with plural-forms

2009-05-27 Thread Zdenek Kotala
Peter Eisentraut píše v út 26. 05. 2009 v 13:39 +0300: > 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. Fix attached. I found only two problems, both in psql. I did not fix .po files. Is necess

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Peter Eisentraut
On Tuesday 26 May 2009 16:47:44 Tom Lane wrote: > The method breaks the instant you have any additional > values to print. For example, this ain't gonna work: > >printf (ngettext ("One file removed, containing %lu bytes", > "%d files removed, containing %lu bytes",

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Aidan Van Dyk
* Alvaro Herrera [090526 10:06]: > Tom Lane wrote: > > > That advice is, if not outright wrong, at least incredibly > > short-sighted. The method breaks the instant you have any additional > > values to print. For example, this ain't gonna work: > > > >printf (ngettext ("One file remov

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Peter Eisentraut
On Tuesday 26 May 2009 17:19:50 Tom Lane wrote: > Alvaro Herrera writes: > > I think it should use the %2$s style specifier in that case. This > > should work: > > > > printf (ngettext ("One file removed, containing %2$lu bytes", > > "%d files removed, containing %lu bytes", n),

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Tom Lane
I wrote: > ... Notice also that we have subtly embedded the > preferred English phrase ordering here: if someone wants to pull the > same type of trick in a language where the bytecount ought to come > first, he's just plain out of luck. Uh, scratch that [ not enough caffeine yet ]. What this cod

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Tom Lane
Aidan Van Dyk writes: > From the glibc printf man page: >"There may be no gaps in the numbers of arguments specified using > '$'; for example, if arguments 1 and 3 are specified, argument 2 must > also be specified somewhere in the format string." > So, is skipping 1 allowed? No --

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Aidan Van Dyk
* Tom Lane [090526 10:56]: > Actually, configure checks to see if the local printf supports m$ or > not, and we use our own printf implementation if not. So I'm not > worried about #2. I agree with your other points though. > > (So, if you wanna see how this is done, try src/port/snprintf.c)

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera writes: > > I think it should use the %2$s style specifier in that case. This > > should work: > > > printf (ngettext ("One file removed, containing %2$lu bytes", > > "%d files removed, containing %lu bytes", n), > > n, total_bytes); >

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Tom Lane
Alvaro Herrera writes: > I think it should use the %2$s style specifier in that case. This > should work: > printf (ngettext ("One file removed, containing %2$lu bytes", > "%d files removed, containing %lu bytes", n), > n, total_bytes); How's that gonna work? In the n

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Greg Stark
Isn't case I think in these two cases that using "one" is actively a bad idea. These aren't English sentences they're fragments meant to report numerical results to programmers. We don't use "two" or "three" either. If the value were just part of some full sentence where the actual value

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Alvaro Herrera
Tom Lane wrote: > That advice is, if not outright wrong, at least incredibly > short-sighted. The method breaks the instant you have any additional > values to print. For example, this ain't gonna work: > >printf (ngettext ("One file removed, containing %lu bytes", >

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Tom Lane
Peter Eisentraut writes: > On Monday 25 May 2009 19:11:24 Zdenek Kotala wrote: >> 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 i

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Zdenek Kotala
Peter Eisentraut píše v út 26. 05. 2009 v 13:39 +0300: > On Monday 25 May 2009 19:11:24 Zdenek Kotala wrote: > > > > 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 issu

Re: [HACKERS] problem with plural-forms

2009-05-26 Thread Peter Eisentraut
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): incompa

[HACKERS] problem with plural-forms

2009-05-25 Thread Zdenek Kotala
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