Re: [COMMITTERS] pgsql/src/backend/postmaster postmaster.c - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [COMMITTERS] pgsql/src/backend/postmaster postmaster.c
Date
Msg-id Pine.LNX.4.30.0111071948280.835-100000@peter.localdomain
Whole thread Raw
Responses Re: [COMMITTERS] pgsql/src/backend/postmaster postmaster.c
List pgsql-hackers
Tom Lane writes:

> > Sorry, this sort of thing doesn't work with message internationalization.
>
> Why not?  Certainly the messages are in two parts, but I doubt there is
> any language with grammar so irregular that it can't be made to work.

Surely everything can be made to work, but I'll bet lunch that there are
plenty of languages where it won't work the way it is now.

> If it were only the one erroneous message, I wouldn't have troubled.
> But there were four (soon to be five) places that all had the same
> problem, ie failure to cover the "can't happen" case.  Repeating that
> logic five times, producing fifteen somewhat-redundant error messages
> to translate, didn't seem like a win.

I agree it's ugly, and I did consider several options when I first changed
it to be this way, but I don't think it can work without a bit of
butchering up the message.  (See below.)

> Especially not when I fully expect there to be some #ifdefs in there
> soon to cover platforms that don't have WIFEXITED and friends.  The
> code as committed has one place to fix such problems, not five.

That path is already covered.  There is precendent in portable packages to
use the W* macros.  Only in some cases you might have to define them, but
that is all.

> I thought about alternative strategies like passing the noun phrase
> into the formatExitStatus subroutine, but that didn't seem materially
> better. Can you give a concrete example of a language where this
> really doesn't work, keeping in mind that the original isn't exactly
> the Queen's English either?

I know for a fact that the translation of "exited" and "terminated" will
vary depending on the noun phrase in Russian and related languages.  Verbs
depending on nouns is a common pattern, and in most cases you can't paint
over it with parentheses because the clarity of the message will suffer.

However, while I don't have actual examples, there are other
possibilities, such as the noun phrase depending on what the rest is,
because what is passive in English might have to be translated differently
so the subject becomes the object.  Or the word order is different and the
noun phrase is in the middle of the sentence.  Or what if subject and verb
are pasted to become one word, or the whole sentence becomes one
hieroglyph?  Or you write right-to-left (ugh, does that even work?).

The bottom line is, constructing sentences dynamically, even if it's
"simple enough" or known to work in all 3642 civilized languages, is a
dead end, because human languages don't make any sense.  It's best to not
even try.

Now back to reality.  I think passing in the noun phrase as you suggested
should be okay:

DEBUG:  process %d (%s) exited with status %d
DEBUG:  process %d (%s) was terminated by signal %d

where %s is the noun phrase.

It loses some elegance, but it should allow grammatically sound
translations.  (Okay, we assume that all languages allow for parenthetical
notes, but that is not a matter of grammar.)

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-hackers by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: PostgreSQL v7.2b2 Released
Next
From: Peter Eisentraut
Date:
Subject: Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed