On Thu, Jun 24, 2010 at 11:29:48AM +0800, Craig Ringer wrote:
> You might want to investigate internationalization options instead,
> where you can process your "master" sources to produce a list of
> strings, and have translators translate those strings. Your code loads
> the string lists, and depending on the setting for the "current
> language" decides which mapping of strings to translations to use when
> emitting messages.
>
> This adds significant complexity to your code, especially since (AFAIK)
> there aren't really any good i18n tools for Pg's SQL, PL/PgSQL, etc.
But there is - whether good or not: Go to
http://gitorious.org/gnumed and browse the tree under
gnumed/server/SQL/. Look at the i18n schema which provides
functions for registering strings for translation and
translating them (i18n.upd_tx()) and using translated
strings nearly transparently in your queries like so:
SELECT _(label) FROM your_label_table;
Which will return label translated into what the connected
user registered as his preferred language or in the source
language if none registered or no translation available.
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346