Re: plpgsql is not translate-aware - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: plpgsql is not translate-aware
Date
Msg-id 20080905165205.GH4353@alvh.no-ip.org
Whole thread Raw
In response to Re: plpgsql is not translate-aware  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > Actually this is wrong -- since the library is going to run with
> > "postgres" text domain, we need to add the files to the backend's
> > nls.mk:
> 
> Can't we give it its own text domain?  It seems fundamentally wrong
> for a plug-in language to require core support for its messages.
> (Now that I think about it, that may have been the reason we don't have
> localization for it already.)  I suppose this must be possible,
> since e.g. glibc manages to have its own messages separate from
> whatever app it's linked with.

I'm not sure how this'd work.  I think this would require plpgsql using
dgettext (passing a domain) instead of plain gettext(), but since it
uses ereport() just like the backend, I don't see a good way to make
that work.

Maybe another idea would be to call textdomain() just before calling
anything that would raise an error, and reset it on exit.  But since
backend errors can happen at any time too, this doesn't seem possible.

Not sure how glibc does it.  Maybe they just use dgettext().

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Withdraw PL/Proxy from commitfest
Next
From: Tom Lane
Date:
Subject: Re: 8.4devel out of memory