on gettext plural support

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: pgtranslation-translators(at)pgfoundry(dot)org
Subject: on gettext plural support
Date: 2009-04-12 01:10:07
Message-ID: 20090412011007.GB7351@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-04-12 01:17:44 Re: [pgtranslation-translators] on gettext plural support
Previous Message David Fetter 2009-04-11 23:37:46 Re: Closing some 8.4 open items