Обсуждение: Re: [COMMITTERS] pgsql/src/backend/postmaster postmaster.c

Поиск
Список
Период
Сортировка

Re: [COMMITTERS] pgsql/src/backend/postmaster postmaster.c

От
Peter Eisentraut
Дата:
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



Re: [COMMITTERS] pgsql/src/backend/postmaster postmaster.c

От
Tom Lane
Дата:
Peter Eisentraut <peter_e@gmx.net> writes:
> Now back to reality.  I think passing in the noun phrase as you suggested
> should be okay:

I'm happy to do it that way if you prefer, but I'm a tad baffled as to
why it solves anything other than word-order issues.  Seems like the
inflection issues are still there.

> 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.)

What I'm intending is to pass in the noun phrase and the PID, allowing
the translatable messages in the subroutine to look like
%s (pid %d) exited with status %d

A variant would be to pass in the adjective for "process":
%s process (pid %d) exited with status %d

Does that seem better, worse, indifferent?  If the inflection issues
reach to the root noun but not the adjectives, methinks that might
work better.
        regards, tom lane


Re: [COMMITTERS] pgsql/src/backend/postmaster postmaster.c

От
Peter Eisentraut
Дата:
Tom Lane writes:

> Peter Eisentraut <peter_e@gmx.net> writes:
> > Now back to reality.  I think passing in the noun phrase as you suggested
> > should be okay:
>
> I'm happy to do it that way if you prefer, but I'm a tad baffled as to
> why it solves anything other than word-order issues.  Seems like the
> inflection issues are still there.

If you put the noun phrase in parenthesis it won't affect the grammar of
the sentence outside.

> > 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.)
>
> What I'm intending is to pass in the noun phrase and the PID, allowing
> the translatable messages in the subroutine to look like
>
>     %s (pid %d) exited with status %d

This is not effectively different from what we have now, it only inverses
which part of the sentence gets pasted where.

> A variant would be to pass in the adjective for "process":
>
>     %s process (pid %d) exited with status %d
>
> Does that seem better, worse, indifferent?  If the inflection issues
> reach to the root noun but not the adjectives, methinks that might
> work better.

Assuming that there will be an adjective in the translation is already
assuming too much.

How about this:

elog(xxx, "whatever process (pid %d) terminated abnormally (%s)", formatExitStatus(exit_status));

where formatExitStatus() returns either of

"exit status 77"
"signal 11"

(Except for the first invocation in CleanupProc, including the word
"abnormally" adds more clarity for the user than trying to format the
numeric details inline.)

I see you already made some changes.  Sorry that it took me a while to
respond, but I can make these changes if we can agree.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: [COMMITTERS] pgsql/src/backend/postmaster postmaster.c

От
Tom Lane
Дата:
Peter Eisentraut <peter_e@gmx.net> writes:
> How about this:

> elog(xxx, "whatever process (pid %d) terminated abnormally (%s)", formatExitStatus(exit_status));

> where formatExitStatus() returns either of

> "exit status 77"
> "signal 11"

But exit status 0 is not abnormal.  I guess in the CleanupProc case
you could leave out the word "abnormally" and just say terminated (%s).

> I see you already made some changes.  Sorry that it took me a while to
> respond, but I can make these changes if we can agree.

I took your lack of comment as assent ... if you want to change it as
above, I won't object, but I think what's there now is workable as long
as the translator understands that the two sets of messages go together.
        regards, tom lane