Re: Remove an unnecessary errmsg_plural in dependency.c - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Remove an unnecessary errmsg_plural in dependency.c
Date
Msg-id CALj2ACV+T+_uLbbk=sRP7-VnbJoeF6caK+E2FvVHpUDMSLG0EA@mail.gmail.com
Whole thread Raw
In response to Re: Remove an unnecessary errmsg_plural in dependency.c  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: Remove an unnecessary errmsg_plural in dependency.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Remove an unnecessary errmsg_plural in dependency.c  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On Thu, Mar 24, 2022 at 6:35 PM Peter Eisentraut
<peter.eisentraut@enterprisedb.com> wrote:
>
> On 24.03.22 13:48, Bharath Rupireddy wrote:
> > Yes, the singular version of the message isn't required at all as
> > numReportedClient > 1. Hence I proposed to remove errmsg_plural and
> > singular version.
>
> The issue is that n == 1 and n != 1 are not the only cases that
> errmsg_plural() handles.  Some languages have different forms for n ==
> 1, n == 2, and n >= 5, for example.  So while it is true that in
>
>      errmsg_plural("drop cascades to %d other object",
>                    "drop cascades to %d other objects",

Thanks. I think I get the point - is it dngettext doing things
differently for different languages?

#define EVALUATE_MESSAGE_PLURAL(domain, targetfield, appendval)  \
    { \
        const char     *fmt; \
        StringInfoData  buf; \
        /* Internationalize the error format string */ \
        if (!in_error_recursion_trouble()) \
            fmt = dngettext((domain), fmt_singular, fmt_plural, n); \
        else \
            fmt = (n == 1 ? fmt_singular : fmt_plural); \
        initStringInfo(&buf); \

Regards,
Bharath Rupireddy.



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: turn fastgetattr and heap_getattr to inline functions
Next
From: Japin Li
Date:
Subject: Re: turn fastgetattr and heap_getattr to inline functions