on gettext plural support - Mailing list pgsql-hackers

From Alvaro Herrera
Subject on gettext plural support
Date
Msg-id 20090412011007.GB7351@alvh.no-ip.org
Whole thread Raw
Responses Re: [pgtranslation-translators] on gettext plural support  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: [pgtranslation-translators] on gettext plural support  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
After spending some time with the new plural string translation support,
I admit I am confused.

I was just going over this string in pg_dump:

#: pg_dump.c:5011
#, c-format
msgid "expected %d check constraint on table \"%s\" but found %d\n"
msgid_plural "expected %d check constraints on table \"%s\" but found %d\n"

So I've been assuming that msgstr[0] is for the case where there is one
of the pluralizable thing, and msgstr[1] is for the case where there is
more than one.  This is the correct thing to do for spanish, where I
have

"Plural-Forms: nplurals=2; plural=n != 1;"

So it turns out that for the string above it doesn't make any sense to
have the %d being exactly 1: the code is
   ntups = PQntuples(res);   if (ntups != 1)   {       write_msg(NULL, ngettext("query returned %d row instead of one:
%s\n",                               "query returned %d rows instead of one: %s\n",
ntups),                ntups, query->data);       exit_nicely();   }
 

So ntups is either 0, or it's greater than 1 -- the first message does
not really make sense to me ...

I'm not really seeing whether I have to cater for the case where there
are zero tuples (in which case the english message is not really
correct, is it?), or that ntups equals one (which is impossible and thus
I could just insult the Pope in that translation and no one would
notice), or ...?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Closing some 8.4 open items
Next
From: Alvaro Herrera
Date:
Subject: Re: [pgtranslation-translators] on gettext plural support