Re: Mark class_descr strings for translation

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Álvaro Herrera <alvherre@kurilemu.de>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2026-07-07T12:39:02Z
Lists: pgsql-hackers
On 07.07.26 13:51, Álvaro Herrera wrote:
> On 2026-Jul-03, Kyotaro Horiguchi wrote:
> 
>> diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c
>> index 9a7a401aced..0d28d34412d 100644
>> --- a/src/backend/catalog/pg_depend.c
>> +++ b/src/backend/catalog/pg_depend.c
>> @@ -810,7 +810,7 @@ dependencyLockAndCheckObject(Oid classId, Oid objectId)
>>   			ereport(ERROR,
>>   					(errcode(ERRCODE_UNDEFINED_OBJECT),
>>   					 errmsg("referenced %s was concurrently dropped",
>> -							get_object_class_descr(classId))));
>> +							_(get_object_class_descr(classId)))));
> 
> I agree with the patch idea in general, but I'm not sure that this
> string is really adequate.  For instance, with this string we cannot
> make "referenced" and "dropped" in the right gender declension depending
> on the object type, and that will make the message look weird in some
> languages -- specifically in Spanish but I'm guessing it can be a
> problem in others as well.
>       "rol referenciado fue borrado concurrentemente"
>     "tabla referenciada fue borrada concurrentemente"
> and so on.
> (Most object types are feminine, but at least "role" and "operator" are
> masculine.)
> 
> I propose we make this
>    "referenced object of type \"%s\" was concurrently dropped"
> 
> so that the declension of "referenced" and "dropped" refer to the gender
> of the word "object".  We'd no longer have a problem there:
>    "el objeto referenciado de tipo "tabla" fue borrado concurrentemente"
> This reads a bit odd, but we no longer have a grammatical gender problem
> there.
> 
> (We could leave out the quote marks, perhaps.)

The class_descr is meant for internal messages only, for the reasons you 
describe.  The fact that there is now a non-internal message that uses 
it is a bug and that should be fixed at that caller.

When I was working on generating the ObjectProperty tables 
automatically, I was working toward getting rid of class_descr 
altogether, because it's mostly not useful.  (For internal error 
messages, you might as well just print the actual catalog name.)  I 
don't think we should be working toward making this facility more 
attractive now.